我正在尝试在API21上使用
有没有其他解决办法?据我所知,Android始终会选择PNG资源,但如果是这种情况,那么如何在API21上使用矢量图和在较低的API中使用PNG呢?
[更新1]
如果我们使用drawable-xxhdpi-21资源文件夹,则Android将选择矢量而不是PNG资源。但这意味着我们还必须为其他密度(例如xhdpi,hdpi等)复制或建立符号链接。
VectorDrawable
,但Android会加载来自xxhdpi
文件夹的PNG资源。我的当前res
结构如下:
- res
- drawable-xxhdpi
- test_icon.png
- drawable-21
- test_icon.xml
- drawable-xxhdpi
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/test_icon"/>
有没有其他解决办法?据我所知,Android始终会选择PNG资源,但如果是这种情况,那么如何在API21上使用矢量图和在较低的API中使用PNG呢?
[更新1]
如果我们使用drawable-xxhdpi-21资源文件夹,则Android将选择矢量而不是PNG资源。但这意味着我们还必须为其他密度(例如xhdpi,hdpi等)复制或建立符号链接。