I've a very simple code for making tabs , this is my layout code :
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/red"
app:tabGravity="fill"
app:tabIndicatorColor="#F48917"
app:tabIndicatorHeight="2.5dp"
app:tabMode="fixed"
app:tabTextColor="#fff">
</android.support.design.widget.TabLayout>
it's inside a linearlayout
this is my java code for making tabs:
tabLayout = (TabLayout) findViewById(R.id.tabs);
TabLayout.Tab firstTab = tabLayout.newTab(); // Create a new Tab names "First Tab"
firstTab.setText("First Tab"); // set the Text for the first Tab
firstTab.setIcon(R.drawable.ic_launcher); // set an icon for the first tab
tabLayout.addTab(firstTab);
the problem is , it doesn't shows an empty tab without anything in it on android api +21 ,but it shows the tab in android below 21
How can I fix this ? what is the problem of this ?
this is the image on api 21+ :
this is the image on api below 21