I just started learning Android Development and wanted to know that is there a way to make TextViews more creative. Like can we apply gradient filter or add shadows to it.
I tried using some background color and other properties.
I just started learning Android Development and wanted to know that is there a way to make TextViews more creative. Like can we apply gradient filter or add shadows to it.
I tried using some background color and other properties.
Copyright © 2021 Jogjafile Inc.
Here's an example of how to use shadows in TextView:
And as for the background, we first need to create a shape that has the appearance we want and we can apply that shape appearance onto the TextView.
To do so, we first make a new xml file (Drawable Resource File) in the drawable folder which is found under the "res" folder.
You can find more information about android xml shapes online but here's a simple example of a rectangular shape that has a linear gradient background:
You can apply this shape by adding the android:background="@drawable/custom_shape" attribute to your TextView. (You need to rename custom_shape to the name you chose for the xml file)