2013-09-05 1 views
3

아주 복잡한 하위 항목 xml로 ExpandableListView를 만들었습니다. 그것은 TextView, Checkbox 및 EditText를 포함합니다. 내가 해당 위젯 내 자식 항목을 볼 수ExpandableListView 하위 항목의 EditText가 포커스를 유지할 수 없습니다.

<TableLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal" 
       android:stretchColumns="1"> 
    <TableRow> 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     > 
     <TextView 
      android:id="@+id/lblData1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textSize="14dip" 
      android:paddingTop="2dp" 
      android:layout_marginLeft="4dp" 
      android:text="@string/lblTitle1" 
      android:paddingLeft="?android:attr/expandableListPreferredChildPaddingLeft"/> 
     <EditText android:layout_width="wrap_content" 
       android:layout_height="wrap_content" android:selectAllOnFocus="true"> 

     </EditText> 
    </TableRow> 
    </TableLayout> 

목록보기 잘 목록을 표시하지만 난 글고 내부를 클릭 할 때, 그것은 두 번째 분할과 초점을위한 키보드를 표시합니다 : 그것의 일부는 다음과 같습니다 다음 자식으로 넘어 가서 키보드을 숨 깁니다 (포커스가 없어져 다음 EditText로 이동하지 않습니다).

어떻게 방지 할 수 있습니까? EditTexts 안에 텍스트를 쓰고 싶습니다.

답변

15

두가 설정이 필요합니다 : 활동에 대한의 AndroidManifest.xml에서

expListView.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);

  • :

    <activity android:name=".InfoActivity" android:windowSoftInputMode="adjustPan">

  • UI를 코드에서

    +1

    XML로도 작업 할 수 있습니다. android : descendantFocusability = "afterDescendants"...이 답변을 찾으려면 몇 시간 동안 검색해야합니다. 고마워요 @Nestor –

    +0

    @ShirishHirekodi 다행스럽게 도울 수 있어요 :) – Nestor

    관련 문제