Numeric edittext loses focus after first input in listview
I have multiple edittexts in my listview, numeric and normal. When I click on a numeric it gets the focus and pops up the keypad but after I enter 1 number, it loses its focus and I have to click on it again to enter more numbers. Is there a way to keep focus so I can enter more numbers? My normal edittext works perfectly.
I have already tried with adjustpan and different keyboard modes.
edittext code:
<EditText
    android:id="@+id/etEditTextItem"
    android:inputType="number"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ems="5"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:layout_alignParentRight="true" />
Listview code:
         <ExpandableListView
            android:id="@android:id/list"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:background="@color/colorCard"
            android:groupIndicator="@null">
        </ExpandableListView>
The problem is the listview : you have to add the following to manifest in the listview activity
android:windowSoftInputMode="adjustPan"
and the following to listview
android:descendantFocusability="beforeDescendants"
我设法修复它,在调试currentFocus后,我发现listview onExpand()将焦点放在了焦点上,将焦点返回到edittext后设置了editText.requestfocus()。
链接地址: http://www.djcxy.com/p/24242.html