android soft keyboard not showing on button click

This question already has an answer here:

  • Close/hide the Android Soft Keyboard 69 answers

  • 请试试这个,

    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
    

    尝试这样的事情:

     InputMethodManager imm = (InputMethodManager)getSystemService(MainActivity.this.INPUT_METHOD_SERVICE);
    imm.showSoftInput(mainLayout.getWindowToken(), 0);
    
    链接地址: http://www.djcxy.com/p/16616.html

    上一篇: 在新视图中立即显示键盘

    下一篇: 按钮点击时不显示android软键盘