Hello everyone, I have a question, how can I make the final part of my textView appear dissipated or with some transparency? For example, I put a text in my textView that is long and my textView has a fixed size that I put and I would like it to instead of my text being cut off at the end it will show me as dissipated or with some transparency like this
Thank you very much in advance.
Making use of alpha and adding the textStyle property to your TextView You have two ways:
XML
PROGRAMMATICALLY
For transparency:
There are several ways, the most common is to apply a transparency to the color of the text:
You can also directly apply the property
android:alpha
to the widget:If we define an alpha of 0 the text looks completely transparent, if we define an alpha of 100:
and if we define an alpha of 255, it would look completely opaque.
If you want to apply transparency to part of the text, it can be done with a SpannableString :
If it's just text, you can use html and, by assigning colors with transparency, do it by hand. For example, this text:
However, if you do it this way, a gradient to transparent that is so progressive with that of your image will be tedious. I still put it here in case it works for you.