How do I set the background color of the home screen app widget programmatically?
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.
Find the following code..
code:
Button button;
//to change background color..
button.setBackgroundColor(Color.Yellow);
use
Yourwidget.setBackgroundColor(Color.RED);
hope help
Widget.setBackgroundColor(Color.LTGRAY);
You can change color of ImageView image in "RemoteViews" by doing this:
remoteviews.setInt(viewid, "setColorFilter", color);