Thursday 14 March 2013

Android: Change the Alpha value of button.



To set the Alpha value

Drawable d = getResources().getDrawable(R.drawable.Imagename);
d.setAlpha(50);
buttonId.setBackgroundDrawable(d);


You can set alpha level 0 to 255
o means transparent and 255 means opaque.
to restore the Original button.
Drawable d = getResources().getDrawable(R.drawable.Imagename);
d.setAlpha(255);

buttonId.setBackgroundDrawable(d);

1 comment:

  1. I loved as much as you will receive carried out right here.
    The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get bought an impatience over that you wish be delivering the following.
    unwell unquestionably come more formerly again as
    exactly the same nearly a lot often inside case you
    shield this increase.

    my weblog ... Kosher Catering Los Angeles

    ReplyDelete