简体   繁体   中英

Android Edittext looses focus while typing in the keypad

I have one Edittext and there is a listview below of that edittext.Initailly Listview visibility set to GONE. Once user is typing in the edittext then I am making listview to Visible by populating refined results in the listview. But here after typing one letter in edittext, the edittext looses its focus. Again user needs to click on edittext and have to type to proceed. My question is how to make edittext not loosing focus when listview gets its visibity. Any help greatly appreciated.

just give in xml editext:

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

Set

edittext.requestFocus();

in the place where u are setting the listView visible..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM