我创建了一个带有非常复杂的子项 xml 的 ExpandableListView。它包含一个 TextView、一个 Checkbox 和一个 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 内单击时,它会显示键盘一瞬间,焦点会前进到下一个子项并隐藏键盘(焦点丢失,而不是移动到下一个 EditText)。
我怎样才能防止这种情况?我想在 EditTexts 中写文本。