我想建立一个导航抽屉里的每个项目都有不同的颜色选择(图标色彩和文字颜色)为谷歌Play商店有:
I'd like to build a navigation drawer where each item has a different selection color (the icon tint and text color) as the google play store has:
我不知道他们是如何解决这个问题,我认为他们使用不同的活动,不同的抽屉。我想用碎片,我想改变图标的色彩和文字颜色。任何想法如何,我可以做到这一点?我使用的是谷歌的设计支持库,并在有导航视图抽屉布局。
I'm not sure how they've solved this, I think they use different activities with different drawers. I want to use fragments and I want to change the icon tint and text color. Any ideas how I can do this? I'm using google's design support library and a drawer layout with a navigation view in there.
使用应用:itemIconTint
在 NavigationView
用于图标,并使用应用:itemTextColor
的textColors
use app:itemIconTint
in your NavigationView
for icons and use app:itemTextColor
for textColors
示例:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- This is used when the Navigation Item is checked -->
<item android:color="#009688" android:state_checked="true" />
<!-- This is the default text color -->
<item android:color="#E91E63" />
</selector>
上一篇:的Visual Studio 2015年RTM科尔多瓦项目不会调试/部署到Android,Windows时,Windows手机科尔、多瓦、项目、手机
下一篇:什么静态和非静态viewholder在RecyclerView适配器之间的区别是什么?静态、适配器、区别、RecyclerView