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" /> 

像上面

相关问题