Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shadow on CardView within ConstraintLayout not showing

I have a CardView within a ConstraintLayout.

This view is then inflated and added to a LinearLayout.

I would like the CardView to cast a shadow on the next CardView, but it seems to be clipped by the ConstraintLayout. How can I get the elevation shadow to show on the CardView without providing more padding or margins for it?

i.e. How can I cast the shadow on an adjacent item?

<LinearLayout>
    <ConstraintLayout>
        <CardView> <-- This view's shadow is cut
        ...
        </CardView>
    </ConstraintLayout>

    <ConstraintLayout>
        <CardView>
        ...
        </CardView>
    </ConstraintLayout>
<LinearLayout>
like image 439
bkach Avatar asked Dec 11 '22 09:12

bkach


1 Answers

Try adding this comment inside your card view that's enough

card_view:cardUseCompatPadding="true"
like image 81
Jarin Rocks Avatar answered Dec 12 '22 22:12

Jarin Rocks