silveira neto

carbon-based lifeform. virgo supercluster

Menu Close

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>

© 2016 silveira neto. All rights reserved.

Theme by Anders Norén.