Convert String to Drawable

后端 未结 8 2094
我在风中等你
我在风中等你 2021-02-20 12:31

I want to raise a notification showing an icon in the status bar - so far so good, but actually I would like this icon to be a 3 character String.

So my question is: Is

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-20 13:12

    I have used a workaround and it worked properly for me.

    First i convert the string to bitmap and then convert it to a drawable, here is the code:

    byte [] encodeByte=Base64.decode(":",Base64.DEFAULT);
    Bitmap bitmap=BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length);      
    Drawable d = new BitmapDrawable(bitmap);
    

    Hope it helps!

提交回复
热议问题