键盘上方的android按钮 [英] android button above keyboard
本文介绍了键盘上方的android按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建一个简单的活动,其顶部为EditText,底部为Button.最后一个打开时,它应该在键盘上方,但是我没有得到任何好的结果(它停留在底部,被键盘隐藏了).
I'm trying to creat a simple activity with an EditText at the top and a Button at the bottom. This last should be above the keyboard when it is open, but I don't get any good result (it stay on the bottom, hidden by the keyboard).
我发现了很多与此相关的主题,所以我尝试了:
I found lot of subjects on this, so I tryed :
- android:windowSoftInputMode ="adjustResize"(也可以通过AdjustPan使用)
- android:fitsSystemWindows ="true"
- 滚动视图
但这没有帮助.
有我的xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/search_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:fitsSystemWindows="true">
<fr.bowo.app.widget.page.EditTextPreIme
android:id="@+id/edit_text_dialog"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginTop="100dp"
android:gravity="center"
android:hint="Rechercher par mot..."
android:imeOptions="actionSearch"
android:inputType="textAutoCorrect"
android:lines="1"
android:maxLines="1"
android:textAppearance="@style/BoldFont"
android:textColor="@color/black"
android:textSize="@dimen/title" />
<Button
android:id="@+id/search_image"
android:layout_width="@dimen/icon_size"
android:layout_height="@dimen/icon_size"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="@dimen/border_small"
android:layout_marginEnd="@dimen/border_small" />
</RelativeLayout>
感谢您的帮助.
推荐答案
使用下面的布局.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/et"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/search_image"
android:layout_width="100dp"
android:text="Hit"
android:layout_centerHorizontal="true"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
/>
</RelativeLayout>
并且您的活动的清单条目应该是.
And manifest entry of your activity should be.
<activity
android:name=".MainActivity"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustResize">
</activity>
这篇关于键盘上方的android按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文