Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 当软键盘出现时,将视图锚定到屏幕顶部_Android_Android Softkeyboard - Fatal编程技术网

Android 当软键盘出现时,将视图锚定到屏幕顶部

Android 当软键盘出现时,将视图锚定到屏幕顶部,android,android-softkeyboard,Android,Android Softkeyboard,看起来是个简单的问题,但我找不到任何解决办法 我的布局层次结构也很简单: <RelativeLayout ...> <LinearLayout android:id="@id/header" android:layout_alignParentTop="true" ...> /> <RecyclerView ...> /> <Rel

看起来是个简单的问题,但我找不到任何解决办法

我的布局层次结构也很简单:

<RelativeLayout
    ...>
    <LinearLayout
        android:id="@id/header"
        android:layout_alignParentTop="true"
        ...>
    />
    <RecyclerView
        ...>
    />
    <RelativeLayout
        android:id="@id/footer"
        android:layout_alignParentBottom="true"
        ...>
    />
</RelativeLayout>

/>
/>
/>
发生了什么: 我有一个
EditText
,它是页脚布局的子项。当它获得焦点时,软键盘出现,整个布局被拉起

我想要达到的目标: …,软键盘出现,页眉将保持在顶部,页脚将被拉到软键盘上方(就像现在一样),唯一调整大小的视图将是
回收视图

我尝试了几十种与
windowSoftInputMode
的组合,将我的布局与
ScrollView
相结合。。。但没有任何帮助

这一定很容易,不是吗


编辑:布局是DialogFragment的内容视图,你能添加你的全部代码吗,这样我就可以测试它,这将帮助我们找到并确定问题所在。虽然我尝试了一些效果不错的东西。在下面检查我的答案

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

<RelativeLayout
    android:id="@+id/view_header"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_alignParentTop="true"
    android:background="#00ff00" />

<RecyclerView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/view_header"
    android:layout_above="@+id/view_footer"
    android:background="#006655"/>

<RelativeLayout
    android:id="@+id/view_footer"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true"
    android:background="#009911" >

    <EditText
        android:layout_width="match_parent"
        android:layout_height="match_parent" />


</RelativeLayout>


您能添加您的全部代码吗,这样我就可以对其进行测试,这将有助于我们发现并确定问题所在。虽然我尝试了一些效果不错的东西。在下面检查我的答案

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

<RelativeLayout
    android:id="@+id/view_header"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_alignParentTop="true"
    android:background="#00ff00" />

<RecyclerView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/view_header"
    android:layout_above="@+id/view_footer"
    android:background="#006655"/>

<RelativeLayout
    android:id="@+id/view_footer"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true"
    android:background="#009911" >

    <EditText
        android:layout_width="match_parent"
        android:layout_height="match_parent" />


</RelativeLayout>