BottomNavigationBar-change the tab icon color

前端 未结 4 720
太阳男子
太阳男子 2021-01-07 18:48

I\'ve integrated Bottom Bar Navigation bar on my app. But when I swipe, tab\'s color doesn\'t change. It\'s weird cause I have selector file. Any idea to solve this problem?

4条回答
  •  时光取名叫无心
    2021-01-07 19:03

    I was confused about whole process despite reading all the answers, so here is how I resolved it step by step so beginners can understand it properly

    Let's say you created MainActivity with bottom navigation so

    in your drawable folder create bottom_navigation_selector.xml

    
    
      
      
    
    

    then go to the activity_main.xml layout and add this line in BottomNavigationView

    app:itemIconTint="@drawable/bottom_navigation_selector"
    

    If you also want to change text color accordingly then you need to add this line aswell

    app:itemTextColor="@drawable/bottom_navigation_selector"
        
    

提交回复
热议问题