2015-04-23 134 views
0

这里是buttonclick的方法,但它是不工作...我已经尝试了许多事情,但似乎没有什么是工作Android的软键盘

public void open_keyboard(View view) 
{ 
    message.msg_l(this, "keyboard clicked"); 
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); 
    imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); 
} 
+0

是什么类型来看? –

+0

你的按钮点击调用正确吗? –

+0

是的,它确实......因为它会在屏幕上产生一个“键盘点击”的信息 –

回答

1

请试试这个,

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

雅这将工作 –

+0

它的工作先生....非常感谢你 –

+0

欢迎@AwaisAhmad –

0

尝试这样:

InputMethodManager imm = (InputMethodManager)getSystemService(MainActivity.this.INPUT_METHOD_SERVICE); 
imm.showSoftInput(mainLayout.getWindowToken(), 0);