How to add shadow effect on text in Android Studio using Kotlin.
Last updated Dec 13, 2021In this android example tutorial, we will see how to add shadow effect to text by using Kotlin in android studio.
Implementation:
To begin, Create a new project in android studio and enter the name, select the project location and language to Kotlin. Then press the Finish button.
Open the activity_shadow_effect_text.xml file and add the LinearLayout with orientation (Vertical or horizontal).
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
In activity_shadow_effect_text.xml file, insert an TextView inside a LinearLayout.
<TextView |
For add shadow in text you have to use shadowColor , shadowDx and shadowDy property and set radius of radius by using shadowRadius attribute.
android:shadowDx="8" |
TextView in android has the following properties:
id, padding, textSize, text, textColor, shadowDy, shadowRadius, fontFamily, textStyle, layout_margin etc.
android:padding="10dp" |
Now run the application, you will see the output shown below.
Output:
Complete source code for Shadow Effect on Text Android example:
activity_shadow_effect_text.xml file
<?xml version="1.0" encoding="utf-8"?> <TextView |
Conclusion: We have covered the topic how to add Shadow Effect on Text to Android by using Kotlin.
Article Contributed By :
|
|
|
|
1376 Views |