1

我实现了CoordinatorLayoutAppBarLayoutToolbar隐藏工具栏时滚动和一切工作迎接。
当我实现搜索视图时出现问题。
这里是我的activity_main布局:隐藏键盘不会重新布局

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/main_content" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <FrameLayout 
     android:id="@+id/main_container" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/appbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|enterAlways" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> 

     <View 
      android:id="@+id/appbar_bottom" 
      android:layout_width="match_parent" 
      android:layout_height="1dp" 
      android:background="@android:color/transparent" 
      android:visibility="invisible"/> 

    </android.support.design.widget.AppBarLayout> 

</android.support.design.widget.CoordinatorLayout> 

而且我fragment_layout

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/projects_swipe_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/projects_recycler_view" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:scrollbars="vertical"/> 

</android.support.v4.widget.SwipeRefreshLayout> 

正常布局RecyclerView Normal layout (RecyclerView)

Keyboard shown

ŧ当键盘被隐藏时他在这里遇到问题。
keyboard hidden

+0

你怎么隐藏键盘? – Ahmed

+0

默认情况下,当按下按钮或单击搜索图标时。 –

+0

您的应用程序在Android清单文件中设置此标志: android:windowSoftInputMode =“adjustResize” – Ahmed

回答