How can we change the width and height of linear layout during run time in android? [closed]
Guyz... Plz help.. Give the proper code because i use most of examples of this problem and i m not able to solve this problem ...
How can we change the width and height of linear layout during run time in android??
Step #1: Get the LinearLayout
's LayoutParams
via getLayoutParams()
. The actual class for these will depend on the LinearLayout
's parent.
Step #2: Modify values in the LayoutParams
.
Step #3: Set the LinearLayout
's modified LayoutParams
via setLayoutParams()
.
If you want to change the width/height dynamically you'd use LayoutParams
LinearLayour myLayout = new LinearLayout(this);
parentView.addView(myLayout, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
精彩评论