Bottom Navigation Icon Color Change
I am using a BottomNavigation this when i try to change bottom navigation icon colors with black background its not change color. bottomNavigation.setAccentColor(Color.parseColor(
Solution 1:
I have an another solution, if you wanna try in XML,
app:itemBackground="@color/white" --> This can be use to bottom bar color app:itemIconTint="@color/blue" --> This can be used to change icons color app:itemTextColor="@color/blue" --> This can be used to change icon bottom text color
XML source code shown as below
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
app:itemBackground="@color/white"
app:itemIconTint="@color/blue"
app:itemTextColor="@color/blue"
app:menu="@menu/navigation" />
Solution 2:
According to the documentation of ahbottomnavigation repo, setBackgroundColor()
will override the accent colors for icons.
Replace setBackgroundColor()
with setDefaultBackgroundColor()
:
bottomNavigation.setDefaultBackgroundColor(Color.BLACK);
Post a Comment for "Bottom Navigation Icon Color Change"