我刚遇到一个我不知道如何解决的问题.它看起来很傻但我找不到解决方法.
我在android中有一个带有几个EditText的表单,当你提交表单时,它检查那些EditText,如果他们有错误的数据,我将EditText更改为红色边框(应用9patch图像).
myEditText.setBackgroundResource(R.drawable.edittext_red);
Run Code Online (Sandbox Code Playgroud)
问题是,我想在用户更改EditText时恢复android的默认样式,但我不知道该怎么做.如果我做:
myEditText.setBackgroundResource(0);
Run Code Online (Sandbox Code Playgroud)
它会删除所有内容,而这不是我想要的.
谢谢!
android nine-patch android-edittext android-resources android-drawable
我有一个jQuery Mobile + phonegap的项目,我的页脚和内容div有一些问题.
一个基本的jQuery Mobile页面如下所示:
<div data-role="page" data-theme="b" id="map">
<div data-role="header" data-theme="b" data-position="inline">
<a href="#" data-rel="back" data-icon="arrow-l">Back</a>
<h1>MAP</h1>
</div><!-- /header -->
<div data-role="content" id="map_canvas">
</div><!-- /content -->
<div data-role="footer" data-theme="d">
<h4>TEST</h4>
</div><!-- /footer -->
</div><!-- /page -->
Run Code Online (Sandbox Code Playgroud)
现在我正在尝试在内容中加载谷歌地图,所以我在JavaScript中使用它:
$('div').live("pageshow", function()
{
var myOptions = {
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
}
Run Code Online (Sandbox Code Playgroud)
这就是结果:
问题是,除非您指定如下属性,否则页脚不会粘到底部data-position="fixed"
:
<div data-role="footer" data-theme="d" data-position="fixed">
<h4>TEST</h4>
</div><!-- /footer -->
Run Code Online (Sandbox Code Playgroud)
这很好,但问题是地图是在jquery mobile加载到底部之前加载的,因此我有这个页面:
您只能使用在移动到底部之前留下的空间来查看地图的位置.
我的问题是..我应该等待什么事件,或者我需要添加到我的代码中以加载地图以便它将使用页眉和页脚之间的所有空间?
我得到了在webview中显示活动指示器的代码.我检查了多个参考文件,但仍然无法使其正常工作.你能帮我调试下面的代码吗?
活动指示器未附带以下代码
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
final BaseActivity MyActivity = ReviewWebActivity.this;
setContentView(R.layout.review_web);
getWindow().setFeatureInt(Window.FEATURE_PROGRESS,
Window.PROGRESS_VISIBILITY_ON);
ScannedProduct product = getReviewUrl();
reviewUrl = product.getReviewLink();
if (reviewUrl == null) {
String err = product.getErrorCode();
if(err.equals("")) err ="No Data Available for this product";
Toast.makeText(getApplicationContext(),
"No Data Available for this product", 1).show();
return;
}
webReview = (WebView) findViewById(R.id.webReview);
webReview.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
// Make the bar disappear after URL is loaded, and …
Run Code Online (Sandbox Code Playgroud) 从今天开始,我的应用程序发生了一些奇怪的事情.每次我单击设置了android:onClick属性的按钮时,我都会收到IllegalStateException:找不到方法...
我注意到只有当我在文件中启用Proguard时才会发生:default.properties
这是我的proguard.cfg:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, …
Run Code Online (Sandbox Code Playgroud) 当我在模拟器中运行时,我有一个大尺寸的应用程序,我得到了这个异常
com.android.ddmlib.SyncException: No space left on device
Run Code Online (Sandbox Code Playgroud)
有人能告诉如何解决这个问题吗?
我的应用程序中有一个切换按钮.我想以编程方式更改或控制默认设置,自动旋转屏幕(设置>显示>自动旋转屏幕).有人知道怎么做这个吗?
我已经在我的网站上集成了谷歌地图但是当我打开检查元素地图将工作,当我关闭地图将消失.请让我知道这是什么问题
之前
打开检查元素后.
代码就在这里
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<input type="text" id="latitude" placeholder="latitude">
<input type="text" id="longitude" placeholder="longitude">
<div id="map" style="width:500px; height:500px"></div>
<script src="https://maps.googleapis.com/maps/api/js"></script>
<script>
function initialize() {
var $latitude = document.getElementById('latitude');
var $longitude = document.getElementById('longitude');
var latitude = -25.363882;
var longitude = 131.044922;
var zoom = 7;
var LatLng = new google.maps.LatLng(latitude, longitude);
var mapOptions = {
zoom: zoom,
center: LatLng,
panControl: false,
zoomControl: false,
scaleControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new …
Run Code Online (Sandbox Code Playgroud) 我正试图从我手机上的相册中选取的图像中获取base64,但我无法使其工作:
我试过这个:
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
console.log("0");
fileSystem.root.getFile(imageURI, null, function(fileEntry) {
console.log("1");
fileEntry.file(function(file) {
console.log("2");
var reader = new FileReader();
reader.onloadend = function(evt) {
console.log("Read complete!");
image64.value = Base64.encode(evt.target.result);
};
reader.readAsText(file);
}, failFile);
}, failFile);
}, failSystem);
Run Code Online (Sandbox Code Playgroud)
虽然图像显示正确..我从此函数收到错误:
fileSystem.root.getFile(imageURI, null, function(fileEntry)
Run Code Online (Sandbox Code Playgroud)
错误是:FileError.ENCODING_ERR
我知道代码看起来不漂亮.但我不知道如何从imageURI获取Base64编码.
我已经构建了一个Android应用程序,它捕获图像并保存在/ mnt/sdcard/Pictures/MyFolder中.实际上应用程序运行正常,并且图像存储在给定路径中.问题是在重新启动设备之前我无法看到图像.我可以处理编码中的情况吗?
提前致谢.
我正在使用我的应用程序中的编辑文本字段.当我点击它时出现软键盘.但是当我点击"完成"按钮(在软键盘上)时,它应该消失但它不会消失.我将输入类型设置为布局文件中的文本.我想按下按钮时隐藏软键盘.请帮忙.谢谢.
这是我的代码.
public class locupdate extends MapActivity implements OnDoubleTapListener{
GeoPoint p,geoPoint;
MapView SearchMap;
List<Overlay> list;
MapController map_controller;
LocationManager locationManager;
Location location,update_location ;
MyLocationOverlay me;
Button go_btn,done;
String city;
int cid;
Double lat_update,lng_update;
EditText location_entered;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.bingmapupdate);
go_btn=new Button(getApplicationContext());
go_btn=(Button)findViewById(R.id.go_button);
location_entered=(EditText)findViewById(R.id.enterLocationforSearch);
location_entered.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
location_entered.setText("");
}
});
done=new Button(getApplicationContext());
done=(Button)findViewById(R.id.button_locationUpdateDone);
done.setEnabled(false);
done.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor=preferences.edit();
String memberid=preferences.getString("unique_userName", null);
String …
Run Code Online (Sandbox Code Playgroud) 我正在使用Android中的一个Button遇到奇怪的行为.
我创建了一个自定义按钮(MyButton),我在其上放了一些方法来扩展deafult View,比如添加一个禁用/启用方法来更改按钮.
这是MyButton的代码:
public class MyButton extends Button {
/** Enabled. */
private boolean enabled = true;
/** The default bg. */
private Drawable defaultBG = null;
/** The disabled drawable. */
private int disabledDrawable = 0;
/******************/
/** CONSTRUCTORS **/
/** [...] **/
/******************/
/**
* Disable.
*/
public void disable()
{
this.setClickable(false);
this.setFocusable(false);
Log.d("MY_BUTTON", "DISABLED!!");
if(!enabled || disabledDrawable == 0)
return;
defaultBG = this.getBackground();
this.setBackgroundResource(disabledDrawable);
enabled = false;
}
/**
* Enable.
*/
public void enable()
{ …
Run Code Online (Sandbox Code Playgroud) android ×9
android-view ×1
base64 ×1
blackberry ×1
cordova ×1
css ×1
google-maps ×1
hide ×1
indicator ×1
inspect ×1
ios ×1
map ×1
nine-patch ×1
proguard ×1
webview ×1