如何更改按钮,动态的机器人的大小机器人、按钮、如何更改、大小

2023-09-05 10:23:53 作者:别跟我讲二手情话

我尝试setWidth(),并自动调用setHeight()方法,但它不能正常工作

I try setWidth() and setheight() method but it not work

推荐答案

尝试使用的LayoutParams。例如

Try using LayoutParams. For example

button.setLayoutParams(新的LayoutParams(50,LayoutParams.WRAP_CONTENT)