android - How can clear ImageButton's background? -


i have imagebutton default drawable image. code set imagebutton layout size after modification image doesn't cover whole button because of centerinside scaletype. in onclick event use code replace imagebutton's image.

button.setimagebitmap(img); button.invalidate(); 

the new image smaller old one. after replace new image appears old image parts can see around new. how can force clear old image or redraw whole imagebutton show new image?

<imagebutton             android:id="@+id/btnphotofront"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_margin="3dp"             android:layout_weight="1"             android:background="@android:color/transparent"             android:contentdescription="@string/front"             android:scaletype="centerinside"             android:src="@drawable/camera" /> 

i tried android:background="#00000000" has no effect. repaint works if don't set background , leave default gray button layer.

try

android:background="@null" 

also note setting 2 different properties. setimagebitmap not corresponding method android:background

    b.setbackground(drawable)     b.setimagebitmap(bm); 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -