android:shadowColor不适用于白色

时间:2012-08-20 10:55:13

标签: android shadow

有简单的xml-layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:gravity="center"
    android:padding="5dp" >

    <Button
        android:padding="15dp"
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:shadowColor="@android:color/black"
        android:shadowDy="10"
        android:shadowRadius="5"
        android:text="Button" />
 </LinearLayout>

当我将其设置为活动的内容视图时,我会在按钮文本下方看到黑色阴影。但如果我将android:shadowColor="@android:color/black"更改为android:shadowColor="@android:color/white" - 我再也看不到阴影了。为什么呢?

1 个答案:

答案 0 :(得分:0)

我自己也碰到了这个。对我来说,它发生在背景明亮的时候,明亮背景上白色阴影的混合并不明显。我将android:shadowRadius更改为小(0.1)并解决了问题。