Android – EditText of expandablelistview child cannot maintain focus

I created an expandablelistview with a very complex sub item XML. It contains textview, Check@R_ 572_ 2419 @ and EditText. Some contents are as follows:

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

The list view shows the list well. I can see my sub items and their corresponding widgets, but when I click inside EditText, it will show the keyboard. For a moment, the focus advances to the next child and hides the keyboard (the focus is lost, rather than moving to the next EditText)

How can I prevent this? I want to write text in edittexts

resolvent:

Two settings are required:

>In UI code:

expListView.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); > In activitymanifest.xml:

< activity android:name =“.InfoActivity”android:windowSoftInputMode =“adjustPan”>

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>