Dynamically changing the linearlayout width or height on Android

前端 未结 4 1377
离开以前
离开以前 2020-12-08 10:28

I am trying to change linear layout or any other widget width or height dynamically but throwing exception.

My layout is:



        
4条回答
  •  误落风尘
    2020-12-08 10:40

    Check this - http://smartandroidians.blogspot.com/2010/04/changing-layout-height-dynamically.html

    ll.getLayoutParams().height = 300;
    ll.getLayoutParams().width = 200;
    ll.requestLayout();
    

    This works also on event handler.

提交回复
热议问题