我在 Galaxy SIII(4.0.4) 和 HTC Desire HD (2.3.5) 等一些 android 设备上遇到了一个奇怪的问题。当我打开一个 webview 时,一个假输入会呈现在原始输入之上,就像附加的屏幕截图中一样。
有任何想法吗?
提前致谢。
编辑:
Java 代码:
final Dialog dialog = new Dialog(PreferencesActivity.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.some_dialog);
dialog.setCancelable(true);
final WebView premiumPurchasingView = (WebView) dialog.findViewById(R.id.purchaseWebView);
WebSettings webSettings = premiumPurchasingView.getSettings();
webSettings.setJavaScriptEnabled(true);
premiumPurchasingView.addJavascriptInterface(dialog, "Dialog");
premiumPurchasingView.addJavascriptInterface(new JavascriptInterface(PreferencesActivity.this), "Android");
premiumPurchasingView.addJavascriptInterface(PreferencesActivity.this, "Preferences");
premiumPurchasingView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
dialog.show();
final ProgressDialog progressDialog = ProgressDialog.show(
PreferencesActivity.this,
getResources().getString(R.string.preloader_title),
getResources().getString(R.string.preloader_content)
);
premiumPurchasingView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
super.onPageFinished(view, url);
}
});
premiumPurchasingView.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onJsAlert(WebView view, String url, String message, final android.webkit.JsResult result) {
new AlertDialog.Builder(view.getContext())
.setTitle("alert")
.setMessage(message)
.setPositiveButton(android.R.string.ok,
new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
result.confirm();
}
}).setCancelable(false).create().show();
return true;
}
});
premiumPurchasingView.loadUrl("URL HERE");
HTML 代码:
<div id="redeemCode">
<input placeholder="phone number"type="text" id="gsm_phone" size="10" onkeypress="if(this.value.length > 9) return false;" name="gsm_phone" style="margin-top:18px; padding:8px 0 9px; width:100%; background-color:#ececec;-webkit-border-radius: 3px;-moz-border-radius: 3px; border-radius: 3px; border:1px solid #cccccc;color:black;font-size:18px;" />
</div>