Imagebutton In Android With Transparent Background
I have follow this post to make ImageButton in android android image button The image appears to the button but it has some background , my Image is a png image and I want the but
Solution 1:
add this line to your ImageButton xml layout.
android:background="@null"
Solution 2:
Here's an alternative solution that worked for me:
android:background="@android:color/transparent"
As Sunny said, add it to the ImageButtons' XML layout
Solution 3:
In your code use this:
ImageButtonbtn=newImageButton(this);
btn.setImageResource(R.drawable.btn_close);
btn.setBackgroundResource(0);
Solution 4:
I don't know if there is any method to do that, but you can paint completely transparent .png file and use method setBackGroundResource() or in XML using this : android:background
Solution 5:
By this way you can set transparent background to ImageButton:
<ImageButton android:id="@+id/imagebutton"android:layout_width="wrap_content"android:layout_height="wrap_content"android:src="@drawable/<imageresourcename>"android:background="@null"></ImageButton>
Post a Comment for "Imagebutton In Android With Transparent Background"