简体   繁体   English

Android - Drawable 在不同的地方有不同的颜色

[英]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.

相关问题 在drawable中制作一个布局,它有3个相同颜色的边框,一个是不同的 - Make a layout in drawable that has 3 borders of same color and one is different 可绘制的android使顶部边缘以不同的颜色倒圆 - Drawable android to make top edge rounded with different color Android:自定义AlertDialog具有不同的文本颜色 - Android: Custom AlertDialog has different text color Android drawable:不同的密度或比例 - Android drawable: different densities or scale Android不同的可绘制屏幕分辨率 - Android different drawable screen resolutions 适用于不同分辨率的Android可绘制图像 - Android drawable images for different resolutions 如何在android中的drawable.xml中为不同样式设置不同的实体属性颜色? - how to set different color of solid property for different styles in drawable.xml in android? 启动另一个活动后,如何在一个Android Honeycomb活动中释放可绘制内存? - How can I free Drawable memory in one Android Honeycomb Activity after a different Activity has started? Android应用程序中可绘制文件夹中图像的大小不同 - Different Size of images in drawable folder in android app 更改按钮android:背景到不同的drawable - Change button android:background to different drawable
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM