Android的EditText无法自动弹出输入法问题

来源:互联网 发布:数据精灵源地址 编辑:程序博客网 时间:2024/05/18 01:22

方法2:

/**
 * 显示键盘
 * 
 * @param context
 * @param view
 */
public static void showInputMethod(Context context, View view) {
InputMethodManager im = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
im.showSoftInput(view, 0);
}



方法3:

给activity配置加入android:windowSoftInputMode="adjustResize"。

问题解决。


解决方法1.:

调用代码:

//自动弹出键盘
InputMethodManager inputManager = (InputMethodManager) getApplication().getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);

使用handler延时。

问题解决。

如果直接在oncreate()中调用,没有进行延时,输入法还是无法弹出。




原创粉丝点击