OnClick EditText Looses Focuse in Custom ListView In Android
If you set up your layout like the one showed above you'll soon have to deal with an annoying problem. For some unknown reason the EditText immediately loses focus, and it's almost impossible to write anything.
Fortunately the solution is quite easy: you just have to add the following lines of code:
in the AndroidManifest.xml file add the following line for the Activity containing the ListView: android:windowSoftInputMode="adjustPan";
in the layout file of the Activity add the following line to your ListView:
1. android:windowSoftInputMode="stateHidden|adjustPan"
2. android:descendantFocusability="beforeDescendants"
Fortunately the solution is quite easy: you just have to add the following lines of code:
in the AndroidManifest.xml file add the following line for the Activity containing the ListView: android:windowSoftInputMode="adjustPan";
in the layout file of the Activity add the following line to your ListView:
1. android:windowSoftInputMode="stateHidden|adjustPan"
2. android:descendantFocusability="beforeDescendants"
<activity
android:name=".TestReading"
android:windowSoftInputMode="stateHidden|adjustPan"/></application>
<ListView
android:id="@+id/light_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/radio_group_roomtype"
android:dividerHeight="15.0sp"
android:descendantFocusability="beforeDescendants"/>
Comments
Post a Comment