VectorDrawable not rendering correctly on API 23

前端 未结 3 727
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-24 12:25

I am replacing all my icons with VectorDrawables wherever possible. But I noticed a couple of them don\'t render correctly on API 23 and the color seems to be bleeding out.

3条回答
  •  温柔的废话
    2020-12-24 13:11

    I had exactly the same problem on API 23 only. I was setting my ImageView source dynamically, rather than in xml. I realised the problem was that I was doing:

    Drawable show = getContext().getResources().getDrawable(resourceId);
    

    When I should have been doing:

    Drawable show = AppCompatResources.getDrawable(getContext(), resourceId);
    

    I hope this helps someone!

提交回复
热议问题