java - onLayout() behavior in Android -


i have custom view add button controls dynamically. in onlayout method, have logic below.

@override protected void onlayout(boolean changed, int left, int top, int right, int bottom) {     super.onlayout(changed, left, top, right, bottom);     (int = 0; < this.getchildcount(); i++) {         this.getchildat(i).layout(left, top, right / 2, top + 200);     } } 

this crops button control instead of shrinking. layout() change width of view or crop it.

do need call measure child in onmeasure().

thanks in advance.

yes, speaking, measure tells views how big be, , layout tells views be. if override layout without measure, views drawn full size in wrong position, , cropped canvas.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

Redirect to a HTTPS version using .htaccess -