Skip to content Skip to sidebar Skip to footer

Capture Layout Resize Before Api 11

I am dynamically creating a board, made of views that are dynamically set in a relative layout. In my onCreate i call the constructor of my Board class that creates everything:

Solution 1:

The most elegant solution is to extend RelativeLayout class, then you can just override onSizeChanged:

protectedvoidonSizeChanged(int w, int h, int oldw, int oldh)

If you need to know the size just after inflate you can try to measure view manually: so call measure(...) than layout(...) and then getMeasuredWidth()/getMeasuredHeight should return the correct size. But this is more tricky, don't use it if you're not sure how it works.

Solution 2:

Post a Comment for "Capture Layout Resize Before Api 11"