我已尝试使用以下代码在应用程序加载时显示软键盘,并提供此url代码的一些帮助,但软键盘未显示。不知道我做错了什么。
public class MainActivity extends DroidGap {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//KeyBoard keyboard = new KeyBoard(this, appView);
// appView.addJavascriptInterface(keyboard, "KeyBoard");
super.loadUrl("file:///android_asset/www/index.html");
InputMethodManager mgr = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
// only will trigger it if no physical keyboard is open
mgr.showSoftInput(appView, InputMethodManager.SHOW_IMPLICIT);
((InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(appView, 0);
}
}