Reputation: 124
Basically I want to increase the size of the icon and maybe set text instead but I want to set text per xml
or over the Tablayout
to the current tab item I don't get anything and can't increase the image size of the tab item ?
How to make the text visible and how to change size of the icon in Tabitem
?
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="56dp"
android:theme="@style/AppTheme.AppBarOverlay">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabsMain"
android:layout_width="match_parent"
android:layout_height="56dp">
<com.google.android.material.tabs.TabItem
android:layout_width="56dp"
android:layout_height="56dp"
android:icon="@drawable/ic_testiranje"
android:text="SDSDSDS" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/ic_homeblue"
android:text="SDSDSDS" />
</com.google.android.material.tabs.TabLayout>
</com.google.android.material.appbar.AppBarLayout>
Upvotes: 0
Views: 3428
Reputation: 1963
You can give a style tag to default tab layout by providing its properties like textSize, fontFamily etc.
<style name="TabTheme">
<item name="android:textSize">16sp</item>
<item name="android:textStyle">normal</item>
<item name="android:textAllCaps">true</item>
<item name="android:fontFamily">@font/normal</item>
<item name="android:textColor">@color/colorDefault</item>
<item name="android:includeFontPadding">false</item>
</style>
and use in your activity/fragment.xml as
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:tabBackground="@android:color/transparent"
android:layout_gravity="center_horizontal"
app:tabMode="scrollable"
app:tabGravity="fill"
app:tabIndicatorHeight="0dp"
app:tabSelectedTextColor="@color/colorBlack"
app:tabTextAppearance="@style/TabTheme" />
OUTPUT
Upvotes: 4