2012-06-04 103 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

相關問題