EditText Loses Focus on Click

你离开我真会死。 提交于 2019-11-29 07:49:52
guillaumegoui

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

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>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!