我在对话框中打开网页视图,当我在键盘内打开网站时看不到
这是我的代码
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Title here");
final WebView wv = new WebView(this);
WebSettings webSettings = wv.getSettings();
webSettings.setJavaScriptEnabled(true);
wv.loadUrl("http://www.google.com/");
wv.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
wv.requestFocus(View.FOCUS_DOWN);
return true;
}
});
wv.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_UP:
if (!v.hasFocus()) {
v.requestFocus();
}
break;
}
return false;
}
});
alert.setView(wv);
wv.requestFocus(View.FOCUS_DOWN);
alert.setNegativeButton("Close", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
alert.show();
更新
尝试使用requestFocus
它不起作用。当网络和对话组合时,键盘不起作用吗? Facebook登录对话框如何显示键盘?
是否有任何方法可以在pop中打开网站,键盘应该在那里工作!