java - ImageButton with PNG image with transparent background as background -


i'm developing android application , have created imagebutton programatically:

int dps = 100; final float scale = getactivity().getbasecontext().getresources().getdisplaymetrics().density; int pixels = (int) (dps * scale + 0.5f);  imagebutton button = new imagebutton(getactivity()); button.setimageresource(r.drawable.button_start); button.setlayoutparams(new layoutparams((int)(pixels * 1.24f), pixels)); button.setscaletype(scaletype.fit_center); layout.addview(button); 

my problem i'm using image background transparent see image on grey background.

is there way show image, not grey background?

try

button.setbackgroundresource(0);

through xml should android:background="@null"


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -