开发者

Best way to change width/height of a widget programmatically? [duplicate]

开发者 https://www.devze.com 2023-01-07 05:57 出处:网络
This question already has answers here: Closed 10 years ago. Possible Duplicate: Android: How to resize a custom view programmatically?
This question already has answers here: Closed 10 years ago.

Possible Duplicate:

Android: How to resize a custom view programmatically?

What's the best way to change width/height of开发者_运维问答 a widget (I mean, a UI widget, subclass of android.view.View) programmatically?

Doing something like this works, but it doesn't seem quite right:

ViewGroup.LayoutParams params = mSomeView.getLayoutParams();
params.height += 10;
mSomeView.setLayoutParams(params);


I've been using this approach when to change LayoutParams attributes and it seems good enough for me. After googling i haven't found any other good way to do this.

0

精彩评论

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