Skip to content Skip to sidebar Skip to footer

Edittext Loses Focus On Click

I'm writing an activity to list a bunch of items from the database and show an additional column with a quantity. I implemented an ArrayAdapter to show my custom layout. Here is th

Solution 1:

I had the same problem and I searched for an answer. Here is an answer to a similar question : https://stackoverflow.com/a/9338694/1448661

You have to put a line in your activity in the manifest :

    android:windowSoftInputMode="adjustPan"

And your listview must have this line too :

    android:descendantFocusability="beforeDescendants"

And now you will probably face another problem which is the lost of your text when scrolling. If this happens take a look at this tutorial : http://vikaskanani.wordpress.com/2011/07/27/android-focusable-edittext-inside-listview/

Hope this will help. Goui

Solution 2:

try this:

<EditTextandroid:id="@+id/editText1"android:layout_width="0dip"android:layout_height="wrap_content"android:layout_weight="1"android:ems="10"android:inputType="textShortMessage" ><requestFocus /></EditText>

Post a Comment for "Edittext Loses Focus On Click"