开发者

How can we change the width and height of linear layout during run time in android? [closed]

开发者_如何学Go It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜