Change TextView padding dynamic on widget
I tried to change the padding of a TextView which is placed on a widget. Direct via 'findViewById' it isn't possible because the class extends from AppWidgetProvider.
Therefore I tried to use remoteViews.setBundle with the following code. But this is not a solution.
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, &q开发者_如何学Cuot;setPadding", b);
Does anyone have a solution for me?
You cannot do this. If you look at the android source the setPadding method is not marked with "@RemotableViewMethod" which allows it's value to be set by the RemoteViews object. The only hack we found was to use a different layout.
精彩评论