Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't shadow appearing?

The text appears, and the @color/blue is fine elsewhere in the code, what else is preventing the shadow from appearing? I have tried values of 1, 10, and 100 for the shadowDx & shadowDy as well as shadowRadius. The shadow does not appear either in the editor (which apparently is expected TextView shadow not showing up in preview - although working on real device) or on my phone, which is my testing device.

    <TextView
        android:id="@+id/shadow_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="i should be shadowed ..."
        android:textColor="@android:color/white"
        android:shadowColor="@color/blue"
        android:shadowRadius="2"
        android:shadowDx="1"
        android:shadowDy="1"
        android:textSize="@dimen/text" />
like image 570
dylan murphy Avatar asked Dec 07 '22 14:12

dylan murphy


1 Answers

It only works for me if I use float values. Try this:

 <TextView
        android:id="@+id/shadow_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="i should be shadowed ..."
        android:textColor="@android:color/white"
        android:shadowColor="@color/blue"
        android:shadowRadius="2.0"
        android:shadowDx="1.0"
        android:shadowDy="1.0"
        android:textSize="@dimen/text" />

And yes, the editor doesn't show the shadow, but it should also show a note that it isn't supported.

like image 110
Michell Bak Avatar answered Dec 17 '22 06:12

Michell Bak