nios
nios

Reputation: 1173

Button elevation is not shown because of parent's padding

In a layout like the following :

<RelativeLayout
    android:padding="5dp"
    ... >
        <Button
            android:alignParentBottom="true"
            android:elevation="2dp" />
</RelativeLayout>

The shadow of the Button is not shown because it is "behind" the padding of the parent.

In other words the Button does not automatically takes into consideration its elevation to add some space between itself and the parent's bottom.

How can I make it work ?

Set an additional margin for this button to be sure that elevation's shadow will be show properly ?

Thanks for you help.

Upvotes: 2

Views: 3046

Answers (1)

pdegand59
pdegand59

Reputation: 13029

You can add android:clipToPadding="false" on the parent RelativeLayout.

This will make the parent not clipping it's child view drawing inside his own bounds.

Upvotes: 12

Related Questions