In our applications, when you enter a page, edittext automatically obtains the focus by default. The input method box is displayed, and the user experience is poor,
So how to cancel this default behavior?
I have been searching for it online for a long time. I have a method for listening to Soft Keyboard Events. I have called the clearfouse () method, but I can't even test it! You can disable this default behavior if the corresponding attributes cannot be found in the corresponding XML.
After studying it, add the following attributes under its parent control to solve the problem perfectly:
Android: focusable = "true"
Android: focusableintouchmode = "true"
Example:
<Linearlayout Android: layout_width= "Fill_parent"Android: layout_height= "Wrap_content"Android: Orientation= "Horizontal"Android: focusable
= "True"Android: focusableintouchmode= "True"
edittext Android: ID = "@ + ID/et_enter_msg_content" Android: layout_width =" wrap_content " Android: layout_height = "wrap_content" Android: layout_weight = "1"/> button Android: ID = "@ + ID/sent" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: Text =" @ string/Send "/>