简体   繁体   English

在白色背景上将白色图像显示为灰色:Android

[英]Showing white image as grey on white background: Android

I have an image that is a white square. 我有一个白色方形的图像。 I would like to convert it to a grey image on a white background. 我想将其转换为白色背景上的灰色图像。 I think alpha could be used here but i am not sure. 我认为可以在这里使用alpha,但我不确定。

Hey you can use setColorFilter() method of image view to set a filter/tint for your imageview. 嘿,您可以使用图像视图的setColorFilter()方法为图像视图设置过滤器/色调。 sample- 样品-

  imageView.setColorFilter(Color.GRAY);

 imageView.setColorFilter(Color.GRAY,PorterDuff.Mode.Lighten);

the second one gives a tinted effect. 第二个给人以有色效果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM