Android 键盘上方的安卓按钮

Android 键盘上方的安卓按钮,android,button,keyboard,position,Android,Button,Keyboard,Position,我试图创建一个简单的活动,上面有一个EditText,下面有一个按钮。打开时,最后一个应该在键盘上方,但我没有得到任何好结果(它留在底部,被键盘隐藏) 我在这方面找到了很多主题,所以我尝试: android:WindowsOfInputMode=“adjustResize”(也带有adjustPan) android:fitsSystemWindows=“true” 滚动视图 但这没有帮助 这是我的xml: <RelativeLayout xmlns:android="http://s

我试图创建一个简单的活动,上面有一个EditText,下面有一个按钮。打开时,最后一个应该在键盘上方,但我没有得到任何好结果(它留在底部,被键盘隐藏)

我在这方面找到了很多主题,所以我尝试:

  • android:WindowsOfInputMode=“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>

您的活动的清单条目应为

 <activity
        android:name=".MainActivity"
        android:theme="@style/AppTheme.NoActionBar"
        android:windowSoftInputMode="adjustResize">
    </activity>

使用下面的布局

<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>

您的活动的清单条目应为

 <activity
        android:name=".MainActivity"
        android:theme="@style/AppTheme.NoActionBar"
        android:windowSoftInputMode="adjustResize">
    </activity>


使用此布局将解决您的问题。



使用此布局将解决您的问题。

android:orientation=“vertical”
无需阅读此处,非常感谢,使用:android:theme=“@style/theme.AppCompat.NoActionBar”@Nilu将Linearlayout更改为realtive,因此错误地将其保留在此处。谢谢你的指点。最后,这不是我想要的。按钮现在在一个好地方,但我不再是全屏模式(没有android栏)。当我添加全屏模式时,按钮消失在键盘后面..全屏模式不会调整大小。
android:orientation=“vertical”
不需要阅读这里,非常感谢,它与:android:theme=“@style/theme.AppCompat.NoActionBar”@Nilu一起工作,将Linearlayout更改为realtive,因此它错误地留在了那里。谢谢你的指点。最后,这不是我想要的。按钮现在在一个好地方,但我不再是全屏模式(没有android栏)。当我添加全屏模式时,按钮消失在键盘后面。全屏模式不会调整大小。