There is such a thing as LayoutParams , you can get them from any view, for example, if it is in LinearLayout

 LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) view.getLayoutParams(); 

And you can change the parameters directly.

 lp.height = 100; 

What for? Did Google really forget about encapsulation? Or is there a meaningful application? Which one

  • Found such a discussion: stackoverflow.com/questions/33796162/ ... Of the objective reasons, people suggest a limit on the number of methods. - default locale
  • one
    Well, actually, there is an alternative point of view on the use of getters and setters. If they add up to this.height = height; and return height and this behavior will never change, then what's the point in two unnecessary methods? - rjhdby
  • How so? Check for denial. - Flippy
  • It is very difficult to say whether this behavior will never change. But a drop of truth in the described is. And in the case of behavior change, you can backward compatibility. Oshushenie that no one really values ​​it. - IL Mare

0