Android 当软键盘打开时,RecyclerView隐藏操作栏
我有下面的布局Android 当软键盘打开时,RecyclerView隐藏操作栏,android,android-layout,listview,android-5.0-lollipop,android-recyclerview,Android,Android Layout,Listview,Android 5.0 Lollipop,Android Recyclerview,我有下面的布局 <?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" android:id="@+id/container">
<?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"
android:id="@+id/container">
<com.example.SendMessageLayout
android:id="@+id/chatMessageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
/>
<View
android:id="@+id/separator"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_above="@id/chatMessageLayout"
android:background="@color/seperator_line_inpost"
/>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_above="@id/separator"
>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycleView"
style="@style/BeepMeListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/chatMessageLayout"
android:layout_alignParentTop="true"
android:transcriptMode="alwaysScroll"
/>
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>
而SendMessageLayout只是一个带有EditText和按钮的布局。
在旧的实现中,我使用了普通的旧ListView,因此当我请求编辑文本的焦点时,会出现一个键盘,ListView不会移动,并且第一个项目是可见的。
但随着RecyclerView的出现,所有内容都被推上了屏幕,不仅顶部的项目不在屏幕上,而且整个布局都在操作栏的顶部
下面是它的样子。。。
只需添加一个空的滚动视图,即可解决: 像这样:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_height="match_parent"
android:layout_width="match_parent"
tools:context="me.drakeet.seashell.ui.social.PostActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
</ScrollView>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<me.drakeet.seashell.widget.MultiSwipeRefreshLayout
android:layout_weight="1"
android:layout_marginBottom="4dp"
android:id="@+id/swipe_refresh_layout"
style="@style/BbsBackground"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_reply_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"/>
</me.drakeet.seashell.widget.MultiSwipeRefreshLayout>
<include
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/view_reply"/>
</LinearLayout>
</FrameLayout>
我也遇到了同样的问题,我通过添加 android:WindowsOfInputMode=“adjustResize”
在清单中的活动标记中,我也有同样的问题。。有人能帮忙吗?嗨,找到这个问题了吗?你能告诉我你是如何把actionbar放到XML中的吗?