Reputation: 7168
In pre-5.0 documentation there is an example that shows tabs inside the Action bar:
https://developer.android.com/guide/topics/ui/actionbar.html#Tabs
What is the correct way to achieve that in 5.0+ interface with new Toolbar?
Do I just place widget.TabLayout
inside widget.Toolbar
?
Upvotes: 0
Views: 48
Reputation: 4578
You can place the tablayout widget inside the toolbarwidget like
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:id="@+id/toolbar"
android:background="?attr/colorPrimary">
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_height="wrap_content"
android:layout_width="match_parent"/>
</android.support.v7.widget.Toolbar>
Upvotes: 1