Solution: Find one in EditText's parent control, set it to
| The code is as follows |
Copy Code |
|
Android:focusable= "true"
Android:focusableintouchmode= "true" |
In this way, the default behavior of EditText is truncated!
| The code is as follows |
Copy Code |
|
<linearlayout
style= "@style/fillwrapwidgetstyle" &NBSP;
android:orientation= "Vertical"
android:background= "@color/black" &NBSP;
android:gravity= "Center_horizontal" &NBSP;
android:focusable= "true" &NBSP;
Android:focusableintouchmode= "true" &NBSP;
>
<imageview
android:id= " @+id/logo "&NBSP;
style=" @style/wrapcontentwidgetstyle "&NBSP;
android:background=" @drawable/dream_ Dictionary_logo "&NBSP;
/>
<relativelayout
style=" @style/fillwrapwidgetstyle "
android:background= "@drawable/searchbar_bg" &NBSP;
android:gravity= "center_vertical" &NBSP;
>
<edittext
android:id= "@+id/searchedittext" &NBSP;
style= "@style/wrapcontentwidgetstyle"
android:background= "@null" &NBSP;
android:hint= "Search" &NBSP;
android:layout_marginleft= "40DP"
Android:singleline= "true" &NBSP;
/>
</relativelayout>
</linearlayout
|
After reviewing a lot of data, the following methods are 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"/> |
It's a fake linearlayout, it's not going to show, but it's going to steal the spotlight.
Android removes EditView's default focus issue