[英]Android - Drawable has different color in different places
I have a drawable resource that has a different shades of black in different places我有一个可绘制的资源,在不同的地方有不同的黑色阴影
Drawable code:可绘制代码:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
</vector>
How do i change the color of the icon in the cards to be the same as the one in the navigation drawer?如何将卡片中图标的颜色更改为与导航抽屉中的颜色相同?
Edit: It happens even when the nav drawer is closed Screenshot when the nav drawer is closed:编辑:即使在导航抽屉关闭时它也会发生 导航抽屉关闭时的屏幕截图:
发生这种情况是因为在您的导航视图中,您的菜单元素包含 svg 并使用默认的colorControlActivated
资源颜色colorControlActivated
着色,因此您可以更改 xml 文件中的 svg 颜色,或者在您使用它的任何地方对其进行着色
It looks like you are using the Design Support Library.看起来您正在使用设计支持库。 It may be that the library automatically tints the drawable color to be that shade of gray.
可能是库自动将可绘制颜色着色为灰色阴影。
I'd reccomend getting the hex value for that gray and setting android:fillColor="#FF000000"
to be that value.我建议获取该灰色的十六进制值并将
android:fillColor="#FF000000"
设置为该值。 This way you will have the same gray color everywhere.这样你到处都会有相同的灰色。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.