【发布时间】:2011-09-29 18:30:47
【问题描述】:
我的活动有 android:windowSoftInputMode="adjustResize" 并在 Android 2.1 中相应地表现:
软键盘出现之前
带键盘
但是,在 Honeycomb 中,软键盘不会调整我的布局大小,而是覆盖按钮:
在 10 英寸 Galaxy 选项卡和摩托罗拉 Xoom 上的行为相同。
我已经多次修改我的布局,试图让它与 Honeycomb 兼容,但无济于事。软键盘将向上推一个 EditText 视图,但不是按钮。
Here is a simple app project demonstrating the problem.
编辑:链接已修复。
使用的布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_alignParentBottom="true">
<Button
android:id="@+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save" />
<Button
android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel" />
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true">
<EditText
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
</ScrollView>
</RelativeLayout>
我发现的唯一相关问题是this,但禁用硬件加速对我没有影响。我还阅读了Android guide on making your app compatible with input methods,但没有找到任何解决方案。
我做错了什么吗?或者这是一个有更多信息的错误?
【问题讨论】:
-
可能相关:如果您将 Scrollview 高度设置为 fill_parent,则在 Honeycomb 中,按钮变得不可点击,因为 Scrollview 与按钮重叠并且它们失去焦点。但 2.1 中的情况并非如此。
-
在 3.1 的模拟器中,无论有无
android:windowSoftInputMode,对我来说似乎都可以正常工作。我所做的只是创建一个新项目并将 main.xml 替换为您的布局。我无法下载您的示例项目。 -
@Nicklas Odd,在模拟器中我发现 3.1 和 2.1 都存在问题:软键盘覆盖了按钮。我更正了链接。
标签: android layout resize android-3.0-honeycomb android-softkeyboard