Android编辑文本布局,如Gmail撰写屏幕
我正在努力实现以下目标: 请在此查看图片: 问题在于,每当用户点击compose mail edittext字段时,发送/保存/放弃按钮都会被软键盘隐藏 关于如何使这些按钮始终可见,有什么想法吗? 谢谢 [编辑] 终于解决了!必须使用Linearlayout而不是RelativeLayout,并指定适当的布局权重参数才能达到目的。非常感谢Femi指出按钮需要在ScrollView之外 以下是最终的工作布局xml,以防任何人发现它有帮助:Android编辑文本布局,如Gmail撰写屏幕,android,layout,android-edittext,Android,Layout,Android Edittext,我正在努力实现以下目标: 请在此查看图片: 问题在于,每当用户点击compose mail edittext字段时,发送/保存/放弃按钮都会被软键盘隐藏 关于如何使这些按钮始终可见,有什么想法吗? 谢谢 [编辑] 终于解决了!必须使用Linearlayout而不是RelativeLayout,并指定适当的布局权重参数才能达到目的。非常感谢Femi指出按钮需要在ScrollView之外 以下是最终的工作布局xml,以防任何人发现它有帮助: <?xml version="1.0" encod
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"><ScrollView android:layout_alignParentTop="true"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/InnerRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<EditText
android:id="@+id/editTextCompose"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:gravity="top"
android:singleLine="false" android:lines="5"
android:inputType="text"
android:layout_below="@+id/editTextSubject"
>
</EditText>
</RelativeLayout>
</ScrollView><TableLayout android:id="@+id/recipeButtons"
android:background="#B0B0B0" android:padding="3dip"
android:stretchColumns="0,1" android:layout_alignParentBottom="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow android:gravity="center">
<Button android:id="@+id/editOtherAdditionButton"
android:text="Save" />
<Button android:id="@+id/removeOtherAdditionButton"
android:text="Delete" />
</TableRow>
</TableLayout></LinearLayout>
如@mayra对的回答中所述,您应该查看以了解控制的详细信息
将AndroidManifest中的活动条目修改为
adjustResize
我认为应该这样做。关于这一点还有另一个问题,但看起来最好的方法是使用looks like@Femi击败了我,答案与我尝试使用带有“adjustResize”选项的WindowsofInputMode相同。它没有按预期工作。谢谢你的回复。但我已经尝试过调整大小,但没有成功。你可能需要将整个应用程序包装在滚动视图中,然后锚定底部按钮,同时让EditText填充空间。我正在这样做。RelativeLayout被包装在一个ScrollView中。啊:也许可以尝试adjustPan
:规范说活动的主窗口没有调整大小以为软键盘腾出空间。相反,窗口的内容会自动平移,以便当前焦点不会被键盘遮挡,用户可以随时看到他们正在键入的内容。这通常不如调整大小,因为用户可能需要关闭软键盘才能接触到窗口的模糊部分并与之交互。实际上,您可能需要完全像电子邮件应用程序那样更改布局:将按钮移到RelativeLayout之外。看见