I finally foudn the answer myself. The parameters to layout are relative to the parent and should hence not be passed down to the children.
The following works fine: @Override protected void onLayout( boolean changed, int l, int t, int r, int b ) { int len = getChildCount(); int w = ((r-l)-(len-1)*PADDING)/len; int pos = 0; for( int i=0; i<len; i++ ) { View c = getChildAt(i); c.layout( pos, 0, pos+w, b-t ); pos += w + PADDING; } } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en