如何以编程方式设置主屏幕应用小部件的背景颜色?
How do I set the background color of the home screen app widget programmatically?
记住小部件是remoteView.您的资源非常有限,无法直接更新小部件的 UI.
Remember widget is remoteView. You have very limited resource to updates UI of widget and not directly.
你可以试试:
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.
这篇关于以编程方式更改应用小部件背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!