I want to have semitransparent buttons with fully transparent text on them. If I set text color to say #00FFFFFF and background to #33FFFFFF the text portion isn't transparent and shows background. The text has to be dynamic so I can't use an image.
Asked
Active
Viewed 759 times
0
-
1why cant you set a image for background? – Sree Mar 01 '16 at 11:24
-
@Sree Because the text has to be dynamic – Bugdroid Mar 01 '16 at 11:26
2 Answers
2
i think this is what you are trying to achieve(works with background color, not with background image)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:background="#f00"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#88000000"
android:gravity="center"
android:text="TEXT TO TRANSPARENT"
android:textColor="#f00" />
</LinearLayout>
Create a new layout file, paste the above code and click the layout "preview" button to check how it looks like.
OR
Check this link Button with background color and transparent text

Community
- 1
- 1

Anbarasu Chinna
- 975
- 9
- 28
0
The reason is that you are not setting the background color of button as it supposed to be... try #07000000 for button backgroun

Attiq ur Rehman
- 475
- 1
- 6
- 21
-
Sorry, but then the font also takes the color #07000000 when its supposed to be #00000000. Thanks for help – Bugdroid Mar 03 '16 at 04:42