RemoteViews setLayoutParams?

2019-01-24 15:57发布

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!

1条回答
我命由我不由天
2楼-- · 2019-01-24 16:09

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.

查看更多
登录 后发表回答