I'm trying to create an appwidget with a customizable background. I use a NinePatchDrawable and I would like to change it's color (using the setColorFilter method). This is no problem in an Activity, but it does dot seem possible with the RemoteView object used for appwidgets.
Is there some way to get an ImageView in an appwidget to be updated with a new Drawable, not a Bitmap?
Or if not, perhaps it's possible to get the actual size of the appwidget and convert / save the colored NinePatchDrawable to a Bitmap and then update the ImageView with that?
I already searched quite a bit 开发者_运维百科for a solution, but haven't found anything so far. I hope it's not impossible. Thanks,
Froghut
Is there some way to get an ImageView in an appwidget to be updated with a new Drawable, not a Bitmap?
setImageViewResource()
does not imply a bitmap, but it does have to be a resource.
perhaps it's possible to get the actual size of the appwidget
No, sorry.
I hope it's not impossible.
Don't allow an infinite range of colors. Allow customization for a handful of colors for which you include appropriate resources.
精彩评论