<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:id="@+id/fragment_container">
<com.ismaeldivita.chipnavigation.ChipNavigationBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:id="@+id/bottom_nav_menu"
app:cnb_textColor ="@color/white"
app:cnb_unselectedColor="@color/black"`enter code here`
android:layout_marginBottom="5dp"
app:cnb_menuResource="@menu/bottom_navigation_menu_chef"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
How I can set the text color of the selected item using this library on any other way?
In menu item add app:cnb_textColor="@color/home_label"
Create another XML file in res\color named something like text_color.xml.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- disabled state -->
<item android:state_enabled="false" android:color="#9D9FA2" />
<item android:color="#000"/>
</selector>
In menu item add app:cnb_textColor="@color/text_color"
As i see.. You can set the selected color changing the cnb_textColor
in the bottom_navigation_menu_chef
.
I will get you an example:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/home"
android:icon="@drawable/ic_home"
android:title="Home"
app:cnb_textColor="@android:color/holo_red_dark"/>
<item
android:id="@+id/activity"
android:icon="@drawable/ic_activity"
android:title="Activity"
app:cnb_textColor="@android:color/holo_green_dark"/>
<item
android:id="@+id/favorites"
android:icon="@drawable/ic_heart"
android:title="Favorites"
app:cnb_textColor="@android:color/black"/>
<item
android:id="@+id/settings"
android:icon="@drawable/ic_settings"
android:title="Settings"
app:cnb_textColor="@android:color/holo_blue_light" />
</menu>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.