Edittext in Listview android

后端 未结 6 592
梦如初夏
梦如初夏 2020-12-09 16:05

I have Listview with editext and textview.

When i touch on edittext then edittext lost focus!

I resolved this problem by setting android:windowSoftInpu

6条回答
  •  旧巷少年郎
    2020-12-09 16:36

    I was having the same problem. My numberic keyboard would momentarily appear before being replaced by the qwerty keyboard and the EditText losing focus.

    The problem is that the keyboard appearing makes your EditText lose focus. To prevent this put the following in your AndroidManifest.xml for the appropriate Activity (or Activities):

    android:windowSoftInputMode="adjustPan"
    

    See Android documentation:

    When the input method appears on the screen, it reduces the amount of space available for your app's UI. The system makes a decision as to how it should adjust the visible portion of your UI, but it might not get it right. To ensure the best behavior for your app, you should specify how you'd like the system to display your UI in the remaining space.

    To declare your preferred treatment in an activity, use the android:windowSoftInputMode attribute in your manifest's element with one of the "adjust" values.

    For example, to ensure that the system resizes your layout to the available space—which ensures that all of your layout content is accessible (even though it probably requires scrolling)—use "adjustResize"

提交回复
热议问题