Android InputType keyboard without EditText

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

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 cannot find documentation on how to do this.

Thanks in advance!

+4
source share
1 answer

The solution to this problem is to set all the edittext in LinearLayout and set the visibility to β€œGone” on this LinearLayout, and not on EditText (s).

This way you can focus on EditText programmatically by clicking on any other element.

+5
source

Source: https://habr.com/ru/post/1437435/


All Articles