Drop shadow text

Here's a little tip for creating a decent drop shadow effect in a TextView.

The issue I ran into initially when trying the shadow effects on TextView is that I could rarely get it to look right - instead of a clean, single pixel shadow, it'd always come out fuzzy. It turns out that the secret is that shadowRadius can be a float, and that you should make that float very small. Here's an example style you can apply to TextViews:

<style name="GreyEtchedText">
 <item name="android:textColor">#2F3541</item>
 <item name="android:shadowColor">#88FFFFFF</item>
 <item name="android:shadowRadius">.1</item>
 <item name="android:shadowDx">0</item>
 <item name="android:shadowDy">1</item>
</style>

Of course, you can use whatever colors you want for the foreground/shadow.

comments powered by Disqus