简体   繁体   中英

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.

Hey you can use setColorFilter() method of image view to set a filter/tint for your imageview. sample-

  imageView.setColorFilter(Color.GRAY);

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

the second one gives a tinted effect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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