0

我试图为我的视图应用阴影效果,并发现我可以使用渐变来做到这一点。

我创建了一个 XML 文件

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient 
        android:endColor="@android:color/transparent"
        android:centerColor="@android:color/transparent"
        android:startColor="@android:color/black"
        android:angle="135"/>
</shape>

这很好用,但我需要让它更像一个影子。我需要的是删除渐变中的过渡效果,因为我只需要在一个视图中对角应用两种颜色。怎么做?在此处输入图像描述

4

2 回答 2

0

如果您希望它成为您视图的背景,为什么不将黑白.jpeg.png图像保存在您的内部Drawables并在需要时使用它来指定其尺寸和alpha(不透明度)参数?

于 2014-07-25T08:30:11.843 回答
0

在这种情况下,我建议使用九个补丁可绘制对象

于 2014-07-25T08:32:50.903 回答