EditText Loses Focus on Click

前端 未结 2 1023
南方客
南方客 2020-12-18 10:38

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. He

相关标签:
2条回答
  • 2020-12-18 10:59

    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

    0 讨论(0)
  • 2020-12-18 11:09

    try this:

    <EditText
        android:id="@+id/editText1"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:ems="10"
        android:inputType="textShortMessage" >
        <requestFocus />
    </EditText>
    
    0 讨论(0)
提交回复
热议问题