问题
By default in every activity only home icon is getting highlighted.
- How to change the highlight the icon which is selected ?
- How to change the default highlighting icon ?
- Where to make the changes in which
activity_main.xml
orMainActivity.java
or else menu xml file ?
Login icon is pressed but home is getting highlighted : selector.xml
MainActivity.java
activity_main.xml
nav_items.xml-menu item I pressed the second icon,activity is changed but still home is getting highlighted in emulator
回答1:
Try this
Add a selector.xml
in drawable folder like
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/beyaz" android:state_enabled="true" />
<item android:color="@color/colorPrimaryDark" android:state_enabled="false" />
</selector>
In activity_main.xml add app:itemIconTint="@drawable/selector"
<android.support.design.widget.BottomNavigationView
app:itemIconTint="@drawable/selector"
/>
来源:https://stackoverflow.com/questions/51257473/in-bottom-navigation-bar-icon-is-not-getting-highlighted-even-after-i-selected