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

回答