Programatically changing Textview height and width

后端 未结 3 491
梦谈多话
梦谈多话 2021-01-29 00:02

I have a textview that I want to change the width to match_parent and height to remain at wrap_content. It is nested within a horizontal linearlayout. It is the 2nd in 3 textvie

3条回答
  •  误落风尘
    2021-01-29 00:18

    Assuming your parent is a LinearLayout

    LinearLayout.LayoutParams layoutParam = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    homeButton.setLayoutParams(layoutParam);
    

提交回复
热议问题