Я использую TabLayout, и я прикладываю две вкладки.Содержание фрагмента над текстом Tab в TabLayout
tabLayout.addTab(tabLayout.newTab().setText("Featured"));
tabLayout.addTab(tabLayout.newTab().setText("Filter"));
Затем onTabSelected()
я показываю фрагмент я хочу, согласно которому вкладка пользователь выбрал.
Компоновка моей деятельности является:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ll_container"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill"/>
<FrameLayout
android:id="@+id/fl_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
и расположение фрагментов просто TextView в LinearLayout:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="Projects List Fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Но результат я получаю следующее:
Как вы можете видеть содержание fra gment перекрывает текст Tab, когда он должен появляться под ним. Спасибо
Использование 'RelativeLayout' в виде точки зрения и' android: layout_below' в 'FrameLayout' – Mohit
@Mohit просто попробовал, и это не сработало. – Mes
напишите код, в котором вы вызываете фрагмент –