2010-11-09 34 views
3

我試圖更改放置在窗口小部件上的TextView的填充。 直接通過'findViewById'這是不可能的,因爲類從AppWidgetProvider擴展。更改窗口小部件上的TextView填充動態

因此,我嘗試使用remoteViews.setBundle與以下 代碼。但這不是一個解決方案。

Bundle b = new Bundle(4); 
b.putInt("left", 5);b.putInt("top", 5);b.putInt("right", 
5);b.putInt("bottom", 5); 
remoteViews.setBundle(R.id.name1, "setPadding", b); 

有沒有人有我的解決方案?

+0

標記爲android應該可以幫助找到答案。 – gary 2010-11-09 13:19:49

回答

2

你不能這樣做。如果您查看android源代碼,setPadding方法未標記爲「@RemotableViewMethod」,該值允許RemoteViews對象設置其值。我們發現的唯一破解是使用不同的佈局。

相關問題