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 itCopy codeThe Code is as follows: android: focusable = "true"
Android: focusableInTouchMode = "true"
In this way, the default EditText behavior is truncated!Copy codeThe Code is as follows: <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>