java - Android:ScrollView 不使用键盘滚动

标签 java android android-layout android-softkeyboard android-scrollview

我有一个带有一些 View 的布局,其中一个是 EditText。布局很容易适合一页,但是,当软键盘退出时,布局不会滚动。 以下是我的布局回顾:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/background" >

    <ScrollView
        android:id="@+id/ScrollView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <CheckBox/>

            <TextView/>

            <LinearLayout>
                <EditText>
                    <requestFocus />
                </EditText>
            </LinearLayout>

            <TextView/>

            <LinearLayout>
                <Spinner/>
            </LinearLayout>

        </LinearLayout>

    </ScrollView>

    <Button
        android:layout_alignParentBottom="true" />

</RelativeLayout>

在我的 list 中我已经声明了属性:

android:windowSoftInputMode="adjustResize|stateHidden"

有谁知道它为什么不起作用以及如何确保它起作用?

提前致谢!

最佳答案

我遇到了同样的问题,我在 list 中检查了我的 Activity ,它不起作用的原因是因为我没有使用这个属性:

android:windowSoftInputMode="adjustResize"

现在效果很好,不需要做额外的 anchor 。

关于java - Android:ScrollView 不使用键盘滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15343355/

相关文章:

android - 如何在 Android 上为 cmake 启用剥离

android - Activity 启动 fragment ,但 fragment 未正确加载

Java switch 常量表达式...有什么巧妙的方法可以编译它吗?

java - 如何使用 Jackson 解析具有可变对象名称的 JSON?

java - 如何使用Java删除实时聊天消息

android - 警报/接收器错误太多

Java,java.util.HashMap 无法转换为 org.bson.BSONObject

android - 使用 intent-filter 通过 Adob​​e AIR 应用程序打开文件类型

Android 4x2 小部件

java - 无法在单行中设置 Tablayout 标题