Android studio報錯attribute android:fillColor報錯

轉載自:https://blog.csdn.net/yangshuaionline/article/details/90671322

報錯信息:

Can't process attribute android:fillColor="@android:color/white": references to other resources are not supported by build-time PNG generation. File was preprocessed as vector drawable support was added in Android 5.0 (API level 21) See http://developer.android.com/tools/help/vector-asset-studio.html for details.

出問題代碼:

<path android:fillColor="@android:color/white"
        android:pathData="M20,11L7.8,11l5.6,-5.6L12,4l-8,8l8,8l1.4,-1.4L7.8,13L20,13L20,11z" />

問題原因:

替換android:fillColor="@android:color/white"爲android:fillColor="#ffffff"。在向量drawable中,fillColor必須明確設置屬性,而不是引用其他資源

解決方法:

修改xml中的代碼

<path android:fillColor="#FFFFFF"
        android:pathData="M20,11L7.8,11l5.6,-5.6L12,4l-8,8l8,8l1.4,-1.4L7.8,13L20,13L20,11z" />

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章