Thursday, August 11, 2011

[android-developers] Re: transparent images

thanks a lot :-)

((Button)
findViewById(R.id.spinButton_5)).setBackgroundDrawable(getDrawable(R.drawable.d0));

Bitmap wheelSpin = BitmapFactory.decodeResource(getResources(),
R.drawable.blue_chip);
Canvas canvas = new Canvas(wheelSpin);
Bitmap oneSpin = BitmapFactory.decodeResource(getResources(),
R.drawable.american_n10);
canvas.drawBitmap(oneSpin, 0, 0, null);

Drawable d =new BitmapDrawable(wheelSpin);
((Button)
findViewById(R.id.spinButton_5)).setBackgroundDrawable(d);

On Aug 10, 6:28 pm, Jon Shemitz <shem...@gmail.com> wrote:
> setBackgroundDrawable() sets the Drawable to use as a background; it doesn't
> draw on top of the existing background. To do what you want, you'll have to
> load the opaque background, draw the transparent overlay on top of it,
> create a BitmapDrawable from the composite image, then use that as your
> button's background.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment