How to add tabs to TabLayout in layout xml file in android? -


i have been studying android 2 weeks. developing first android project. in project need work tabs action bar. know common in android. action bar using toolbar v7. know action bar. have issue tab layout. problem want add tabs tab layout in layout xml file.

for example

<tablayout> //tab buttton goes here  <tabbutton1></tabbutton1>  <tabbutton1></tabbutton1>  .  . <tablayout> 

i search many tutorials tablayout. tutorials define tabs tab layout programmatically. please how can define tabs tab layout in xml , define event them programmatically findviewbyid? dont want use button view instead of tabs. please how can achieve ?

this should want:

<android.support.design.widget.tablayout             android:id="@+id/tabs"             android:layout_width="match_parent"             android:layout_height="?attr/actionbarsize"             android:layout_gravity="bottom"             android:background="?attr/colorprimary"             app:tabmode="fixed">              <android.support.design.widget.tabitem                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:text="popular" />              <android.support.design.widget.tabitem                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:text="most rated" />              <android.support.design.widget.tabitem                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:text="favorites" />         </android.support.design.widget.tablayout> 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -