Android中DialogFragment自动弹出输入法

来源:互联网 发布:算法实现是什么 编辑:程序博客网 时间:2024/04/28 04:11
  1. 只需要添加
    1.  editTextPassword.setFocusable(true);  
    2.         editTextPassword.setFocusableInTouchMode(true);  
    3.         editTextPassword.requestFocus();  
    和在onresume()方法里面定义键盘弹出的时间
    1. @Override  
    2.     public void onResume() {  
    3.         super.onResume();  
    4.         log.info("onResume");  
    5.         (new Handler()).postDelayed(new Runnable() {  
    6.             public void run() {  
    7.                 log.info("postDelayed");  
    8.                 InputMethodManager inManager = (InputMethodManager)editTextPassword.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);  
    9.                 inManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);  
    10.             }  
    11.             },500);  
    12.     }  

0 0
原创粉丝点击