简体   繁体   English

ListView中EdiTtext的焦点和软键盘出现问题

[英]problems with focus and Softkeyboard of EdiTtext in ListView

I have two ListViews 我有两个ListViews

android:layout_height="wrap_content"
android:id="@+id/containerLv"
android:background="@drawable/modify_task_master_fragment_style"
android:paddingBottom="6dp"
android:layout_margin="6dp">

<ListView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scrollbars="none"
    android:id="@+id/topListView"
    android:layout_alignParentRight="true" />
<ListView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/topListView"
    android:layout_marginRight="3dp"
    android:layout_marginLeft="3dp"
    android:divider="@drawable/divid"
    android:dividerHeight="1px"
    android:scrollbars="none"
    android:id="@+id/scrollListView"/>

I put dynamically EditText into ListView and when i start typing focus is lost. 我将动态EditText放到ListView中,当我开始键入时,焦点丢失了。 I read about this problem and added to my activity 我了解了此问题并将其添加到我的活动中

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

This solution helped, but another problem occurred - while creating new items in Listview the SoftKeyboard is overlapping my editText. 此解决方案有所帮助,但是又出现了另一个问题-在Listview中创建新项目时,SoftKeyboard与我的editText重叠。 so i cant see what i'm typing. 所以我看不到我在打字。

There is no such problem without SOFT_INPUT_ADJUST_PAN 没有SOFT_INPUT_ADJUST_PAN就没有这样的问题

Include in your manifest: 在清单中包括:

android:windowSoftInputMode="adjustResize"

Also, I recomended you that your root layout be a RelativeLayout. 另外,我建议您将根目录布局设为RelativeLayout。

Hope it helps you :) 希望它能对您有所帮助:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM