向矢量可绘制对象添加阴影效果

Jay*_*tel 5 xml android elevation vector-graphics shadow

我想向矢量可绘制对象添加阴影效果(或高程)。

例如

1.我的第一个文件中包含一个下载图标 ic_file_download_black_24dp.xml

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="48dp"
    android:height="48dp"
    android:viewportWidth="24.0"
    android:viewportHeight="24.0">
<path
    android:fillColor="#FF2e2e2e"
    android:pathData="M19,9h-4V3H9v6H5l7,7 7,-7zM5,18v2h14v-2H5z"/>
Run Code Online (Sandbox Code Playgroud)

2.我的第二个文件包含一个圆形 round_shape.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid android:color="#fffbc02d" />
    <corners
        android:bottomLeftRadius="8dp"
        android:bottomRightRadius="8dp"
        android:topLeftRadius="8dp"
        android:topRightRadius="8dp" />
</shape>
Run Code Online (Sandbox Code Playgroud)

3.现在,我将这两个文件组合在一起以创建单层可绘制对象,如下所示 layered_download_icon.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/round_shape" />
    <item android:drawable="@drawable/ic_file_download_black_24dp" />
</layer-list>
Run Code Online (Sandbox Code Playgroud)

这给了我整体形象,如下所示

在此处输入图片说明

现在,我想对黄色圆圈内的下载图标进行标高。我怎样才能做到这一点?

PS我在ImageButton中设置layered_download_iconsrcCompat