Looking for a long time on the internet, a bit of listening to soft keyboard events, a bit called Clearfouse () method, but the test has not! The corresponding property could not be found in the XML to turn off this default behavior
Solution: Find one in the parent control of the EditText, set to
The code is as follows |
Copy Code |
Android:focusable= "true" Android:focusableintouchmode= "true" |
In this way, the default behavior of the EditText is truncated!
The code is as follows |
Copy Code |
< 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> |
After consulting a lot of data, the following methods are found to be the simplest:
In XML, before the EditText control
Join
The code is as follows |
Copy Code |
<linearlayout Android:id= "@+id/linearlayout_focus" Android:focusable= "true" Android:focusableintouchmode= "true" Android:layout_width= "0px" android:layout_height= "0px"/> |
This is a false linearlayout, will not show, but will steal the focus