2012-06-04 196 views

回答

26

记住widget是远程视窗。您有非常有限的资源来更新小部件的UI,而不是直接。

您可以尝试: remoteViews.setInt(viewId,“setBackgroundColor”,Color.BLACK); 我从来没有使用它,但我想这可能是这样。

我想你需要动态改变颜色。

-5

使用

Yourwidget.setBackgroundColor(Color.RED); 

希望帮助

+0

您的解决方案不使用App部件的工作,病程你不能对widget的变化特性直接访问(只通过使用广播消息) –

-4

找到下面的代码..

代码:

Button button; 

    //to change background color.. 

    button.setBackgroundColor(Color.Yellow); 
+1

按钮引用来自哪里?这是在AppWidgetProvider中。 –

-1
Widget.setBackgroundColor(Color.LTGRAY); 
-1

您可以通过这样做改变的ImageView图像的颜色“RemoteViews”:

remoteviews.setInt(viewid, "setColorFilter", color); 
+0

android.widget.Button没有方法:setColorFilter(int) – iscariot

相关问题