<group
android:translateX="150"
android:translateY="150"
>
<path
android:pathData="..."
android:fillColor="#40000000"
/>
</group>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"
android:strokeWidth="1"
android:strokeColor="#FFEB3B"
android:strokeLineJoin="round" />
<path
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"
android:strokeWidth=".5"
android:strokeColor="#2196F3"
android:strokeLineJoin="round" />
<path
android:fillColor="#FFFFFF"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/></vector>
如果您有像Sketch这样的SVG编辑工具,我建议通过该工具添加阴影并保存SVG文件。然后使用以下工具将其转换为Android可绘制矢量图。 http://a-student.github.io/SvgToVectorDrawableConverter.Web/
最后,下载XML文件到您的drawable文件夹中,或选择复制内容并手动创建新的drawable资源,并将内容复制到其中即可。十分简单 : )。让我知道您的实际操作效果如何。
Drawable
类并在draw
方法中进行绘制,首先绘制阴影,然后再绘制原始的Drawable
。 - pskinkScriptIntrinsicBlur
来模糊边缘。顺便说一下,如果你想要使用不同分辨率的阴影PNG文件,为什么还要使用向量呢? - pskink