coemu
coemu

Reputation: 304

Dynamic merged Background

I have a jpeg "screen" and a number from 0 to 255.

The jpeg is partially transparent.

The number should be used to achieve a grayscale Drawable like it is used in this example to set the background:

setBackgroundColor(Color.rgb(number, number, number)); 

Now, I want to programaticly merge these to values to get a single Image with the "number-Drawable" as Background and the jpeg overlaying it. How can i achieve that?

Upvotes: 0

Views: 48

Answers (1)

Rajesh
Rajesh

Reputation: 15774

You can use a LayerDrawable with a color drawable and a bitmap drawable as the layers. Please take care of supplying the transparency to the bitmap drawable as JPEG image format does not support transparency. Or use a PNG format for the "screen".

Upvotes: 1

Related Questions