Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android keyboard InputType without EditText

For an android app with a custom design, I open the keyboard manually as it have no input on which to focus.

I open it using :

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

I would like to set the keyboard as InputType.TYPE_CLASS_NUMBER but can't found any documentation on how to do this.

Thanks in advance !

like image 707
Simon Rolin Avatar asked Oct 02 '12 17:10

Simon Rolin


1 Answers

The solution to this problem is to set all the edittext in in a LinearLayout and to set visibility to "Gone" on that LinearLayout and not on the EditText(s).

This way you can still focus on the EditText programmatically by doing a click on any other element.

like image 152
Simon Rolin Avatar answered Nov 13 '22 03:11

Simon Rolin