Android TextView Shadow

How to add a shadow in a text view? How to improve the text readability on widgets?

There’s four properties on TextView related to shadows.

First a a normal TextView XML declaration.

<TextView
android:text="I thought what I'd do was, I'd pretend I was one of those deaf-mutes."
android:gravity="center_horizontal"
android:textColor="#000000"
android:layout_width="200px"
android:layout_height="fill_parent">
</TextView>

Now the same TextView with the four shadow properties, the color, the x,y offset and the blur radius.

<TextView
android:text="I thought what I'd do was, I'd pretend I was one of those deaf-mutes."
android:gravity="center_horizontal"
android:textColor="#000000"
android:layout_width="200px"
android:layout_height="fill_parent"
 
android:shadowColor="#555555"
android:shadowDx="5.0"
android:shadowDy="5.0"
android:shadowRadius="3.0">
</TextView>

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">