Reputation: 11
i want to write an application where the user can change the color scheme. I have Imagebuttons and the images on the buttons are pngs and have transparent background. but when i place them on the buttons they are not transparent anymore. could anybody help me with some code? thanks! Anne
Upvotes: 1
Views: 1696
Reputation: 634
write your layout for ImageButton
as:
<ImageButton
android:src="@drawable/your_image"
android:id="@+id/your_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"/>
Hope this helps!
Upvotes: 0
Reputation: 134664
Are you ensuring that android:background="@null"
is set? Otherwise you'll have the gray button background. For example:
<ImageButton
android:background="@null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/my_transparent_png"
/>
Upvotes: 4