I implement TabLayout to similiar Google Play Music app.
This is my layout :
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.design.widget.TabLayout>
My code to handle TabLayout :
private void init() {
mTabLayout = (TabLayout) findViewById(R.id.tab_layout);
mTabLayout.addTab(mTabLayout.newTab().setText("Category 1"));
mTabLayout.addTab(mTabLayout.newTab().setText("Category 2"));
mTabLayout.addTab(mTabLayout.newTab().setText("Category 3"));
mTabLayout.addTab(mTabLayout.newTab().setText("Category 4"));
mTabLayout.addTab(mTabLayout.newTab().setText("Category 5"));
mTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
}
But result is TabLayout doensn't have margin on the left :
I try this article but the result is not as expect. How can i custom TabLayout like Google Play Music app as show above ?