I defined a custom view with a public method:
public void setHeight(int height) {
//this.getLayoutParams().height = height; --- NOT WORKING
this.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, height)); // --- WORKING
When I use the comment out code it doesn't work (meaning that the view height is not changing when calling this method), but when I use the second phrase it's working as expected.
What can explain this behavior?