Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change size of imagebutton in android programatically

I have to create few buttons imagebuttons programatically and i don't know how to change size of them. Changing left and right does not work.

like image 578
qwkldmas Avatar asked Oct 14 '25 09:10

qwkldmas


1 Answers

Use this.

LinearLayout.LayoutParams params = button.getLayoutParams();
params.width = 80;
button.setLayoutParams(params);

it should work

like image 188
Kvk Avatar answered Oct 16 '25 21:10

Kvk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!