文本出现了,@color/blue
在代码的其他地方都很好,还有什么阻止阴影出现?我已经为 shadowDx
和 shadowDy
以及 shadowRadius
尝试了 1、10 和 100 的值。阴影既没有出现在编辑器中(这显然是预期的 TextView shadow not showing up in preview - although working on real 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" />
最佳答案
它仅在我使用浮点值时才适用。试试这个:
<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" />
是的,编辑器没有显示阴影,但它也应该显示一条注释,表明它不受支持。
关于android - 为什么影子没有出现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10670630/