[英]Navigation Drawer change the Icon and text color of highlighted item
我正在尝试选择导航抽屉项目的图标。 我为此准备了以下文件:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/icon_milestone_selected" android:state_pressed="true"/>
<item android:drawable="@drawable/icon_milestone_selected" android:state_focused="true"/>
<item android:drawable="@drawable/icon_milestone_static"/>
</selector>
但是,图标仅在被触摸时才会更改,在关闭导航抽屉并再次打开它时,它不会给我更改后的图标。 我在这里想念什么?
只需添加以下行:
<item android:drawable="@drawable/icon_milestone_selected" android:state_pressed="false" state_activated="true"/>
它应该工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.