Can't get clipChildren=false attribute to work

android, view

Solution

Also set

android:clipToPadding="false"

Beside:

android:clipChildren="false"

Problem

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> ``` - with `android:clipChildren="true"`: with the red `LinearLayout` clipped as expected - with `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:

Original source

Related problems