Rediska Rediska - 26 days ago 13
Android Question

How to prevent soft keyboard from appearing on touch

I don't want the soft keyboard to appear when a particular EditText is touched. But I still want to be able to show the soft keyboard upon user request (say, when a button is pressed) and allow the user to edit the text.
I know how to show/hide the soft keyboard, I only don't know how to prevent it from appearing on touch.
Any suggestion how to do it?

The general idea is that the user will be mostly working with selection/position within the text, and only occasionaly entering characters.
I don't want the visible amount of text to be reduced by the soft keyboard when selecting or navigating the text.

Answer

simply use

 txtEdit.setShowSoftInputOnFocus(false);

and when you want to enable that , reverse above process

Comments