我正在使用以下代码在加载后在 webview 上显示软键盘。但它不起作用。任何帮助将不胜感激。
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
InputMethodManager mgr = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.showSoftInput(this.appView, InputMethodManager.SHOW_IMPLICIT);
((InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(this.appView, 0);
//NOTE: this code should be called after loadurl : disable the default 'save image as' and 'text selection' android dialog boxes on long clicks
this.appView.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return true;
}
});
this.appView.setLongClickable(false);
}