【发布时间】:2016-07-26 09:12:10
【问题描述】:
我有一个与LINK 完全相同的问题,同样的情况和布局中的相同组件。 唯一的区别是工具栏,但显然我使用的是 appcompat 并且行为是相同的。
注意,不仅工具栏被隐藏了,recyclerview的上半部分也被隐藏了。就像当软键盘可见时整个片段被向上翻译。
我在我的活动的 main.xml 中使用了这样的工具栏:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include layout="@layout/toolbar" />
<FrameLayout
android:id="@+id/container_root"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
框架布局被替换为:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:ignore="MergeRootFrame" >
<!--<include layout="@layout/toolbar" />-->
<com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/primary"
android:textColor="#FFFFFF"
app:pstsIndicatorColor="#FFFFFF"
app:pstsPaddingMiddle="true"
android:maxHeight="20dp"
android:elevation="5dp"
/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
在视图寻呼机中,我有一个标签页,其中包含该片段的布局和 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:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerViewChat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="50dip"/>
<EditText
android:id="@+id/txtChatLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/txt_hint"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/button1">
</EditText>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/btn_send"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
当我开始在edittext中输入文本时,整个布局上升,工具栏变得不可见(屏幕外)并且recyclerview不滚动,但它向上移动。
【问题讨论】:
标签: android toolbar android-softkeyboard android-recyclerview