i am using this library to make the same bottom navigation but when i click on item the icon will disappear, here is my code
activity_main:
<com.github.kwasow.bottomnavigationcircles.BottomNavigationCircles
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:forceDarkAllowed="true"
app:labelVisibilityMode="selected"
app:menu="@menu/navigation" />
navigation items:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/destination_ejournal"
android:icon="@drawable/ejournal_selector"
android:title="@string/bottomnav_ejournal" />
<item
android:id="@+id/destination_solah"
android:icon="@drawable/solah_selector"
android:title="@string/bottomnav_solah" />
<item
android:id="@+id/destination_home"
android:icon="@drawable/home_selector"
android:title="@string/bottomnav_home" />
<item
android:id="@+id/destination_dua"
android:icon="@drawable/dua_selector"
android:title="@string/bottomnav_dua" />
<item
android:id="@+id/menu_more"
android:icon="@drawable/more_selector"
android:title="@string/bottomnav_more" />
MainActivity:
val bottomNavigation = findViewById<BottomNavigationCircles>(R.id.navigation)
bottomNavigation.color = Color.WHITE
so what am i doing wrong here?
is it in the activity or XML?
Images of the problem:
If i change color from white to red
home selector:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/home_selected" android:state_checked="true" />
<item android:drawable="@drawable/ic_home" android:state_checked="false" />
</selector>
ic_home: is verctor home_selected: is png
SOLUTION:
i was using a selector to display a different drawable if the "state_checked" and one of them was PNG format so it didn't appear, i used 2 vectors for the selector and it works fine now
I tried your example with that library & the problem is that you're setting the color to white at runtime & that kind of blends into the bottomnav color.
You can try different color e.g red.
val bottomNavigation = findViewById<BottomNavigationCircles>(R.id.navigation)
bottomNavigation.color = Color.RED
It gives me following result: