首先要在EditText的父布局中,设置两个属性.

    android:focusable="true"    android:focusableInTouchMode="true"

然后我写了一个方法,调用这个方法的时候,把EditText的id传

进去就可以

public void showSoftInputFromWindow(EditText editText){        editText.setFocusable(true);        editText.setFocusableInTouchMode(true);        editText.requestFocus();        InputMethodManager inputManager =                (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);        inputManager.showSoftInput(editText, 0);    }





更多相关文章

  1. Android(安卓)中不弹出软键盘的方法
  2. Android获取WIFI 的ssid 方法适配Android9.0
  3. Android基础面试题
  4. Android(安卓)出现 OutOfMemoryError 的一种解决方法
  5. android
  6. android:scaleType属性
  7. 深入Android系统 Binder-3-原理
  8. Android屏幕元素层次结构
  9. android jni 输出log

随机推荐

  1. android 安装和卸载程序
  2. android排版布局学习
  3. android异步图片加载三之handler+线程池+
  4. 【分享】大量android软件开发资料和实例
  5. Android媒体的一些使用总结(2)
  6. ok6410 android driver(1)
  7. Android GreenDao with Android Studio I
  8. Android布局属性详解之RelativeLayout
  9. Install Android Studio in debian Wheez
  10. SeerBar样式