我搜索过,但这里没有问题解决了我的问题。我想达到共同的行为,但我只能这样做:
这是我的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>
我的片段布局:
<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>
我发现的一个解决方案是更新appcompat和recyclerview库,但我有最新版本(23.1.1)所以我不知道发生了什么。
答案 0 :(得分:0)
解决了改变
<item name="android:statusBarColor">@android:color/transparent</item>
到
<item name="android:statusBarColor">@color/primary_dark</item>