0

我試圖隱藏ToolBar,因爲RecyclerView被滾動,但是,ToolBar不會隱藏或移動。這是我是如何實現它:滾動RecyclerView時無法隱藏工具欄,可能的原因是什麼?

<android.support.design.widget.CoordinatorLayout 
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:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true"> 

<android.support.design.widget.AppBarLayout 
    android:layout_height="wrap_content" 
    android:background="?colorPrimary" 
    android:elevation="@dimen/margin_8" 
    android:layout_width="match_parent" 
    android:id="@+id/appbar"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     app:layout_scrollFlags="scroll|enterAlways" 
     android:layout_marginLeft="@dimen/list_toolbar_side_margin" 
     android:layout_marginRight="@dimen/list_toolbar_side_margin" 
     android:layout_width="match_parent" 
     android:layout_height="?actionBarSize" 
     android:background="?attr/colorPrimary"> 

     <TextView 
      android:id="@+id/titleText" 
      android:text="@string/app_name" 
      android:gravity="start|center" 
      android:textSize="19sp" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 
    </android.support.v7.widget.Toolbar> 

</android.support.design.widget.AppBarLayout> 
<FrameLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    > 


     <android.support.v7.widget.RecyclerView 
      android:id="@+id/homeTeamRView" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:clipToPadding="false" 
      android:scrollbarStyle="outsideOverlay" 
      android:paddingLeft="@dimen/list_side_margin" 
      android:paddingRight="@dimen/list_side_margin" 
      android:paddingBottom="@dimen/margin_16" /> 

</FrameLayout> 

如何解決?

+0

'應用:layout_scrollFlags'應該是' AppBarLayout'。你有足夠的內容滾動嗎? – Blackbelt

+0

是的,20個圖像,以線性順序進行回收視圖,足夠滾動我相信 – OBX

+0

@Blackbelt在'AppBarLayout'中嘗試過也不行! – OBX

回答

0

要解決此問題,請在Toolbar部件(android.support.v7.widget.Toolbar)地址:

app:layout_scrollFlags="scroll|enterAlways" 
0

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/AppTheme.AppBarOverlay"> 

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

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

<include layout="@layout/content_eez_dine_home" /> 

像上面

相關問題