I have a yellow RelativeLayout
containing a taller red LinearLayout
.
In order to make the whole LinearLayout
visible, I set android:clipChildren="false"
, but this does not work as expected:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="#FFFF00"
android:clipChildren="false" >
<LinearLayout
android:layout_width="50dp"
android:layout_height="100dp"
android:background="#FF0000"
android:orientation="vertical" >
</LinearLayout>
</RelativeLayout>
android:clipChildren="true"
:with the red LinearLayout
clipped as expected
android:clipChildren="false"
:where the LinearLayout
height is clipped, and the width set in the layout is not respected.
What's wrong?
EDIT
If I wrap the container in a LinearLayout
with both dimensions matching its parent, I get the same result (I checked that the LinearLayout container's container fill the whole screen).
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="#FFFF00"
android:clipChildren="false" >
<LinearLayout
android:layout_width="50dp"
android:layout_height="100dp"
android:background="#FF0000"
android:orientation="vertical" >
</LinearLayout>
</RelativeLayout>
</LinearLayout>
EDIT 2
If I put the android:clipChildren="false"
attribute in the parent LinearLayout, I get the following:
android:clipChildren="false"
allows each child to draw outside of its own bounds, within the parent. It doesn't allow children to draw outside of the parent itself. For that you would need to set android:clipChildren="false"
on the grandparent (as well).
I think what you're seeing with the colors is just because colors have no inherent bounds. If there is nothing clipping them, colors go forever. My theory is that if you used, say, a stretched 1x1 px image instead of a color, things would be different.
Also set
android:clipToPadding="false"
Beside:
android:clipChildren="false"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With