5/05/2014

Android - EditText in ListView lost focus. 리스트뷰 안의 입력창의 포커스가 사라지는 문제

리스트뷰 내부의 EditText의 문제가 두 가지 있다.


  1. 키보드 자체가 사라지는 문제
  2. EditText의 focus가 사라지는 문제


처음으로, 키보드가 자체가 사라지는 문제는 manifest의

android:windowSoftInputMode="adjustPan" 

가 핵심이다.


I have seen that some solutions are using:
android:descendantFocusability="beforeDescendants"
in the layout of the definition of the list.
For me this wasn't necessary. The problem was fixed using android:windowSoftInputMode="adjustPan":
<activity
        android:name="mainActivity"
        android:windowSoftInputMode="adjustPan"
        android:label="@string/app_name" >
    </activity>
in the Manifest.xml.
But you have to make sure that this line of code goes in the activity where you are defining the TabHost or TabActivity!!!.


Reference : http://stackoverflow.com/questions/17003715/edittext-inside-listview-lost-focus


두 번째 문제로,  EditText의 Focus가 사라지는 문제는

ListView가 Focus를 가져간다는 것 같다.

그래서 Focus를 뺏기지 않도록, onItemSelected를 Override해서

직접 Focus 관리를 한다.

내용은 링크 참조.

Reference : http://stackoverflow.com/questions/2679948/focusable-edittext-inside-listview

댓글 없음:

댓글 쓰기