[英]Hide Toolbar with Coordinator layout and RecyclerView in a fragment
I have searched but no questions here solved my problem. 我已经搜索过,但是这里没有问题可以解决我的问题。 I want to achieve the common behaviour, but I only get that:
我想实现共同的行为,但是我只能做到:
Here is my MainActivity layout: 这是我的MainActivity布局:
<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:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activities.MainActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
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:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_add_shopping_cart_white_48dp" />
</android.support.design.widget.CoordinatorLayout>
And my fragment layout: 而我的片段布局:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="3dp"
android:paddingBottom="3dp"
tools:context="es.dmoral.tinylist.fragments.SavedListsFragment">
<android.support.v7.widget.RecyclerView
android:id="@+id/saved_list_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
One solution I've found is updating the appcompat and recyclerview libraries, but I have the last versions (23.1.1) so I don't know what's going on. 我找到的一种解决方案是更新appcompat和recyclerview库,但是我有最新版本(23.1.1),所以我不知道发生了什么。
Solved changing 解决了变化
<item name="android:statusBarColor">@android:color/transparent</item>
to 至
<item name="android:statusBarColor">@color/primary_dark</item>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.