In the project, when you enter a page, edittext automatically obtains the focus by default.
So how to cancel this default behavior?
I have been searching for it online for a long time. I have listened to a soft keyboard event and called the clearfouse () method, but I have not tested it! You cannot find the corresponding attribute in XML to disable this default behavior.
Solution: find one in the parent control of edittext and set it
Android: focusable = "true"
Android: focusableintouchmode = "true"
In this way, the default edittext behavior is truncated!
<Linearlayout
Style = "@ style/fillwrapwidgetstyle"
Android: Orientation = "vertical"
Android: Background = "@ color/Black"
Android: gravity = "center_horizontal"
Android: focusable = "true"
Android: focusableintouchmode = "true"
>
<Imageview
Android: Id = "@ + ID/logo"
Style = "@ style/wrapcontentwidgetstyle"
Android: Background = "@ drawable/dream_dictionary_logo"
/>
<Relativelayout
Style = "@ style/fillwrapwidgetstyle"
Android: Background = "@ drawable/searchbar_bg"
Android: gravity = "center_vertical"
>
<Edittext
Android: Id = "@ + ID/searchedittext"
Style = "@ style/wrapcontentwidgetstyle"
Android: Background = "@ null"
Android: hint = "Search"
Android: layout_marginleft = "40dp"
Android: singleline = "true"
/>
</Relativelayout>
</Linearlayout>