item selected color in android BottomNavigationView

前端 未结 6 1157
别那么骄傲
别那么骄傲 2021-02-01 11:58

I refer this. Schedules Activity is appeared when I click Schedules, but first item color (Favorites) is always selected. It doesn\'t change Schedules item color from Favorites

6条回答
  •  猫巷女王i
    2021-02-01 12:36

    In my situation, I used BottomNavigationBarEx plugin. So, I had to do it like below:

    In my res/layout/layout_navigation_view.xml:

    Added app:itemIconTint="@drawable/bottom_nav_colors". Since, I only used icons. So if you have text add this: app:itemTextColor="@drawable/bottom_nav_colors" also.

        
    

    Then in res/drawable directory (because selectors need to include in drawable or animatable directory) add the selector(as others mentioned):

    
    
        
        
    
    

    Then in res/values/colors.xml add your select and unselect colors, as ex:

    #bfbfbf
    #3F51B5
    

提交回复
热议问题