Apply shadow effect on Android TextView text using xml

How to create drop shadow effects like Photoshop on android app text with the use of Xml layout file.

Shadow effects are most popular simple 3d animation in development area because with the use of shadow effects text it will make text more attractive, easy to read and takes automatically app user attention. Android TextView widget gives us so much different type of attributes to convert normal text style to shadow effect text. So here is the complete step by step tutorial for Apply shadow effect on Android TextView text using xml.
android-project-download-code-button

How to Apply shadow effect on Android TextView text using xml.

Code for MainActivity.java file.

package com.textviewshadoweffectxml_android_examples.com;
import android.app.Activity;
import android.os.Bundle;


public class MainActivity extends Activity {

 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 }

}

Code for activity_main.xml layout file.

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:paddingBottom="@dimen/activity_vertical_margin"
 android:paddingLeft="@dimen/activity_horizontal_margin"
 android:paddingRight="@dimen/activity_horizontal_margin"
 android:paddingTop="@dimen/activity_vertical_margin"
 tools:context="com.textviewshadoweffectxml_android_examples.com.MainActivity" >

 <TextView
 android:id="@+id/textView1"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_centerHorizontal="true"
 android:layout_centerVertical="true"
 android:text="Text With Shadow Effect 1"
 android:textAppearance="?android:attr/textAppearanceLarge"
 android:textStyle="bold"
 android:shadowColor="#a6fcf2"
 android:shadowRadius="4"
 android:shadowDy="-4"
 android:textColor="#019c8a"
 />

 <TextView
 android:id="@+id/textView3"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_below="@+id/textView2"
 android:textStyle="bold"
 android:layout_centerHorizontal="true"
 android:shadowColor="#a6fcf2"
 android:shadowRadius="5"
 android:shadowDy="5"
 android:layout_marginTop="20dp"
 android:text="Text With Shadow Effect 3"
 android:textAppearance="?android:attr/textAppearanceLarge"
 android:textColor="#019c8a" />

 <TextView
 android:id="@+id/textView2"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignLeft="@+id/textView1"
 android:layout_below="@+id/textView1"
 android:layout_marginTop="22dp"
 android:text="Text With Shadow Effect 3"
 android:textAppearance="?android:attr/textAppearanceLarge"
 android:textStyle="bold"
 android:shadowColor="#a6fcf2"
 android:shadowRadius="4"
 android:shadowDx="4"
 android:textColor="#019c8a" />

 <TextView
 android:id="@+id/textView4"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_below="@+id/textView3"
 android:layout_centerHorizontal="true"
 android:layout_marginTop="16dp"
 android:text="Text With Shadow Effect 4"
 android:textAppearance="?android:attr/textAppearanceLarge"
 android:textStyle="bold"
 android:shadowColor="#a6fcf2"
 android:shadowRadius="4"
 android:shadowDx="-4"
 android:textColor="#019c8a" />

</RelativeLayout>

Screenshots:

Apply shadow effect on Android TextView text using xml

Click Here to Download Apply shadow effect on Android TextView text using xml project.

Leave a Reply

Your email address will not be published. Required fields are marked *