Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing app widget background color programmatically

How do I set the background color of the home screen app widget programmatically?

like image 311
Achilles Avatar asked Jun 04 '12 05:06

Achilles


2 Answers

Remember widget is remoteView. You have very limited resource to updates UI of widget and not directly.

You can try :

remoteViews.setInt(viewId, "setBackgroundColor", Color.BLACK);

I never used it but i guess it may be the way.

I guess you need to change color dynamically.

like image 87
Mufazzal Avatar answered Nov 08 '22 22:11

Mufazzal


You can change color of ImageView image in "RemoteViews" by doing this:

remoteviews.setInt(viewid, "setColorFilter", color);
like image 40
E Player Plus Avatar answered Nov 08 '22 21:11

E Player Plus