I have a button on an image. I would like to have this button with a solid background color and transparent text (to display the back image). Is it possible to make it have only transparent text?
Asked
Active
Viewed 1,550 times
3 Answers
2
Try adding these attributes to your Button:
android:textColor="@android:color/transparent"
android:background="@android:color/black"

AdamMc331
- 16,492
- 10
- 71
- 133
1
By transparent do you mean like partially visible. Also look into the image button instead of assigning the background image to a button.

1llum1n471c0nf1rm3d 360noscope
- 79
- 1
- 12
-
I don't think the ImageButton is what they're going for. The way they've described it, they want the button to only cover *part* of the image, and have the text on the button be transparent so the image behind it can be seen. – AdamMc331 Feb 20 '15 at 18:26
1
This sounds like it may be a use case for an ImageButton. It allows specifying an Image and a background. Notice the src and background tags, txt is not required.
<ImageButton
android:id="@+id/imageBtn"
android:layout_width="@dimen/btn_large_len"
android:layout_height="@dimen/btn_large_len"
android:src="@drawable/ic_action_play"
android:background="@drawable/btn_gray" >
</ImageButton>

James L.
- 12,893
- 4
- 49
- 60