片段中的 TabLayout 被 activity 的标题栏遮挡

TabLayout in the fragment is shadowed by activity's title bar

我有一个有 4 个标签的 ActivityTabLayout 位于底部(我知道这违反了准则,但这就是设计)。 Fragment 之一也有应该放在顶部的选项卡,但它被标题栏遮住了。

如何向 Fragment 添加标签,使其不被工具栏遮挡?

这里是activity_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/bg_main"
    android:orientation="vertical">

    <android.support.v4.view.ViewPager
        android:id="@+id/fragments"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/bg_main_tabs"
        app:elevation="@dimen/elevation"
        app:tabIndicatorHeight="0dp"/>
</LinearLayout>

fragment_with_tabs.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/bg_main"
    android:orientation="vertical">

    <android.support.design.widget.TabLayout
        android:id="@+id/clothes_tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/colorAccent"
        app:tabIndicatorColor="@color/colorPrimaryDark"
        app:tabSelectedTextColor="@color/colorPrimaryDark"
        app:tabTextColor="@android:color/white" />

    <android.support.v4.view.ViewPager
        android:id="@+id/clothes_fragments"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>

将海拔设置为 0。从 AppBarLayout 设置海拔是理想的,但无论如何你可以这样做

getSupportActionBar().setElevation(0);