Reputation: 481
I put a background color in a ImageButton? How?
Upvotes: 8
Views: 23364
Reputation: 63
you can use android:backgroundTint insted of android:background
<ImageButton
android:id="@+id/imgImageTab"
android:layout_width="@dimen/_30sdp"
android:layout_height="@dimen/_30sdp"
android:src="@drawable/ic_menu_home"
android:backgroundTint="@color/blue" />
Upvotes: 0
Reputation: 83
You can use android:background=" " to set the color of ImageButton and some android widgets. ('#rrggbb' or '@android.color/blue', '@android:color/transparent'). you can follow this example as your reference.
<ImageButton
android:id="@+id/btnGreen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:src="@drawable/my_image.png"/>
Upvotes: 6
Reputation: 12962
android:background="#rrggbb"
in XML file with layout definition, then use PNG file with transparency as image source
Upvotes: 7