How to make TextView Text Transparent [Android]

To make a TextView text look transparent we need to set the android:alpha attribute to it.

It has a range of 0-1,

If you set android:alpha ="0.1" the text will be 90% transparent, whereas

If you set android:alpha ="0.9" the text will appear 10% transparent (i.e. almost opaque)

You can set alpha manually in XML view, or by simply using the Properties window in the design view of Android Studio (or eclipse equivalent)

Setting alpha property
Setting alpha property
    android:text="@string/hello_world" />

✏️ Note that the alpha attribute is available from API level 11 and higher, so if you are using minSDK levels below level then you won't get any error but the application will simply ignore this attribute and you will not be able to see the effect.

Try Out Code2care Dev Tools:


Android Java Linux Microsoft Google Python macOS Notepad++ Microsoft Teams CSS PHP SharePoint Html Linux C Programs Bootstrap jQuery Sublime Android Studio Facebook Eclipse WhatsApp News MySQL Json HowTos JavaScript FTP S3


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Tutorials, Trouble-Shooting steps, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.
🎉 We are celebrating the 10th years of Code2care! Thank you for all your support! We hope we made a difference.
We strong support Gender Equality & Diversity.

We stand in solidarity with Ukraine - Make a donation to UNHCR -