0
我正在Android Studio中使用ImageButton,并在代码开发过程中需要更改ImageButton的维度。其他设置ImageButton维度的方法
我在上一个问题中遇到了解决方案的一部分。
stackoverflow.com/questions/10992241/set-imagebutton-height-and-width-in-code
android.view.ViewGroup.LayoutParams params1 = button1.getLayoutParams();
params1.height = size;
params1.width = size;
button1.setLayoutParams(params1);
android.view.ViewGroup.LayoutParams params2 = button2.getLayoutParams();
params2.height = size;
params2.width = size;
button2.setLayoutParams(params2);
android.view.ViewGroup.LayoutParams params3 = button3.getLayoutParams();
params3.height = size;
params3.width = size;
button3.setLayoutParams(params3);
是否有其他的方式来管理,而不重复后续的代码全部ImageButtons?
android.view.ViewGroup.LayoutParams params1 = button1.getLayoutParams();
params1.height = size;
params1.width = size;