Kolovrat
Kolovrat

Reputation: 41

How to set BottomNavigationView selected item text to normal, not bold

I have BottomNavigationView in my app. When I select one item, the text is bold. But I want that text stays normal, not bold. How to achieve this? Here is my code

<com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/navView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/backgroundColor1"
            android:elevation="8dp"
            app:itemIconTint="@color/bottom_nav_color"
            app:itemTextColor="@color/bottom_nav_color"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:menu="@menu/bottom_nav_menu" />


bottom_nav _color.xml


<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true" android:color="@color/itemCheckedColor" />
    <item android:state_checked="false" android:color="@color/itemNotCheckedColor" />
</selector>

Upvotes: 1

Views: 338

Answers (1)

Zohaib Islam
Zohaib Islam

Reputation: 11

app:itemTextAppearanceActiveBoldEnabled="false"

This attributes solves the problem. It is the simplest solution.

<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/navView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/backgroundColor1"
android:elevation="8dp"
app:itemTextAppearanceActiveBoldEnabled="false"
app:itemIconTint="@color/bottom_nav_color"
app:itemTextColor="@color/bottom_nav_color"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/bottom_nav_menu" />

Upvotes: 1

Related Questions