Answer the question
In order to leave comments, you need to log in
How to create tabs in fragment?
I have a Navigation Drawer and it contains several fragments. In one of them I want to add a TabLayout. How to do it?
Answer the question
In order to leave comments, you need to log in
You place a TabItem on the TabLayout layout. Here is an example:
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabIndicatorColor="@color/white"
app:tabMode="scrollable"
app:tabSelectedTextColor="@color/colorText"
app:tabTextColor="@color/colorSecondaryText">
<android.support.design.widget.TabItem
android:id="@+id/tabItem1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tab1" />
</android.support.design.widget.TabLayout>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question