views:

243

answers:

1

I've been trying to create a color LinearLayout object (1) within another LinearLayout object (2), while having (1) not display beyond the bounds of (2) - in short, I wish to assign the equivalent of the CSS overflow:hidden property to LinearLayout (2) so that LinearLayout (1) doesn't bleed beyond the edges of (2).

<LinearLayout>
   <!-- (2) -->
   <LinearLayout>
      <!-- (1) -->
   </LinearLayout>
</LinearLayout>

Is this possible within Android?

Thank you for the help!

+1  A: 

LinearLayout is a box layout - I can actually see how your internal (nested) LinearLayout can protrude outside of the parent. Can you perhaps give a more complete code example?

DroidIn.net
Actually I don't have a better example. I've used LinearLayout many times before, but I wish to create a LinearLayout box that hides objects that extend beyond the box. Possible? Thanks DroidIn!
iamkoa
If I understand you right you don't want a child element with size larger than parent to be visible outside parent's boundaries?I think that's what you get by default - I did some tests and if you set for example a LinearLayout 40x40px and then place a button inside and set its size to 60x60px then you will only see piece of button clipped by the parent's dimensions
DroidIn.net
Hmm interesting - I guess the rule must not apply to rounded corners? If you have a parent box with rounded corners, the child box will overflow the rounded corner section. Or at least that's what I've found to be true so far.
iamkoa