androidviewtextview

RemoteViews setLayoutParams?


I would like to set the height of a TextView to WRAP_CONTENT remotely.

How would I do that, since there is no remoteviews.setLayoutParams(viewId, param) function?

I tried remoteviews.setInt.(viewId, "setHeight", -2), but that just sets the height of the TextView to zero...

Thanks!


Solution

  • When you create the RemoteViews, pass in a resource ID to the constructor that has the TextView set to height set to wrap_content. Remember that when you send updates over, you are effectively redrawing the app widget, so you can use your layout files to affect changes that you cannot do via methods on RemoteViews.