У меня есть Activity
с 4 вкладками. TabLayout
находится внизу (я знаю, что это нарушение правил, но это дизайн). У одного из Fragment
также есть вкладки, которые должны быть размещены сверху, но они затенены заголовком.TabLayout в фрагменте затенен заголовком активности
Как добавить вкладки в 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>
Удалить 'app: elevation =" @ dimen/elevation "'. – AlphaQ