0

I have a transparent black and white image. I would like to apply specific color (say red) to the black portion of the image and leave white portion of the image as it is. How do i achieve this with Android mobile?

Thanks

last-Programmer
  • 985
  • 3
  • 9
  • 19
  • You need to be far more specific. – Christopher Schneider Apr 11 '16 at 12:39
  • This is the sample image http://i63.tinypic.com/206h6qw.jpg. In this picture i would like to change the black color to red color. I have tried the solution mentioned in https://stackoverflow.com/questions/5699810/how-to-change-bitmap-image-color-in-android. They all change the white color also to red color – last-Programmer Apr 11 '16 at 22:42

2 Answers2

1

Setting the color filter of imageview to LightingColorFilter (Color.White, Color.Red) provide the expected result.

last-Programmer
  • 985
  • 3
  • 9
  • 19
0

If you have your pic on some view / layout. You can achieve your goal by changing, setting background color on the view / layout under your image. (on the view under half transparent image).

Example

 yourViewUnderPic = findViewById(R.id.yourLayoutID);
 yourViewUnderPic.setBackgroundColor(Color.parseColor("#006400"));
Jakub S.
  • 5,580
  • 2
  • 42
  • 37