android自动弹出软键盘(输入键盘)

在AndroidMainfest.xml内容无法更改情况下,也就是键盘非要弹出情况下,进入此页面时先关闭软键盘不让其弹出

InputMethodManager imm = (InputMethodManager)passwordText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(passwordText.getWindowToken(),0);

再加载完页面完全后在弹出软键盘(控制弹出时间)

警告:对于刚跳到一个新的界面就要弹出软键盘的情况,可能由于界面为加载完全而导致先弹出软键盘后迁移页面。此时应该适当的延迟弹出软键盘如500毫秒(保证界面的数据加载完成)。
Timer timer = new Timer();
timer.schedule(new TimerTask()
{

@Override
public void run()
{
InputMethodManager inputManager =
(InputMethodManager)passwordText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.showSoftInput(passwordText, 0);
}

},
500);

 

解决此问题:http://hw-hanwei-126-com.iteye.com/blog/1628504

相关文章:

  • 2021-08-04
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2021-08-10
  • 2022-12-23
猜你喜欢
  • 2021-12-21
  • 2021-11-02
  • 2022-12-23
  • 2021-08-13
  • 2021-09-11
  • 2021-09-21
  • 2021-07-18
相关资源
相似解决方案