RemoteViews setLayoutParams?

删除回忆录丶 提交于 2019-12-18 17:00:32

问题


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:


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.



来源:https://stackoverflow.com/questions/3330847/remoteviews-setlayoutparams

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!