【问题标题】:Keyboard moving over the content when typing键入时键盘在内容上移动
【发布时间】:2013-08-08 15:30:06
【问题描述】:

我正在使用显示几个 EditTexts 的列表视图。当我单击 EditText 时,内容被正确平移,因此它不会被键盘隐藏(我在 Manifest 中使用了 android:windowSoftInputMode="adjustPan" 来做到这一点)。但是,问题是当我开始在键盘上打字时,所有内容都会回到它的初始位置,所以它被键盘隐藏了。

这只发生在我正在测试的设备上,运行 Android 4.1.2 的 Galaxy Tab 2 10.1 并且在模拟器上没有问题。

有什么想法吗?

提前致谢,瓦伦丁

【问题讨论】:

    标签: android listview keyboard


    【解决方案1】:

    只需将 ScrollView 作为父级放入您的 list_item_layout.xml。喜欢:

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    
    <EditText
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="@string/app_name" >
    </EditText></ScrollView>
    

    【讨论】:

    • EditText 已经在一个 LinearLayout 中,然后它被包含在一个 ListView 中。我不明白为什么使用滚动视图作为父级会有所帮助。不管怎样,我试过了,并没有改变任何东西。
    猜你喜欢
    • 1970-01-01
    • 2013-04-02
    • 1970-01-01
    • 1970-01-01
    • 2020-09-09
    • 2012-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多