Set View Width Programmatically

后端 未结 7 2010
甜味超标
甜味超标 2020-12-01 09:57

I am trying to set the width and height of a view in code to show an ad for a free app I am working on. All of the UI is done in XML with the exception of this ad. Here is t

7条回答
  •  春和景丽
    2020-12-01 10:34

    You can use something like code below, if you need to affect only specific value, and not touch others:

    view.getLayoutParams().width = newWidth;
    

提交回复
热议问题