Selected tab's color in Bottom Navigation View

前端 未结 10 1970
故里飘歌
故里飘歌 2020-11-28 03:47

I\'m adding a BottomNavigationView to a project, and I would like to have a different text (and icon tint) color for the selected tab (to achieve greying out no

10条回答
  •  迷失自我
    2020-11-28 04:11

    I am using a com.google.android.material.bottomnavigation.BottomNavigationView (not the same as OP's) and I tried a variety of the suggested solutions above, but the only thing that worked was setting app:itemBackground and app:itemIconTint to my selector color worked for me.

            
    

    My color/tab_color.xml uses android:state_checked

    
    
        
        
    
    

    and I am also using a selected state color for color/bottom_navigation_text_color.xml

    Not totally relevant here but for full transparency, my BottomNavigationView style is as follows:

        
    

提交回复
热议问题