0

I have a project where I have a padding of 16dp on the parent LinearLayout.
In this LinearLayout I have a cardview which has an elevation.

The problem is here that the elevation won't appear outside the parent div.
In CSS you have overflow:visible for this problem, how would I fix this in Android Studio?

Help would be appreciated :)

Joestoen
  • 545
  • 1
  • 5
  • 14

2 Answers2

0

I'm not quite sure, what you are trying to do, but I think you are looking for the FrameLayout where you can place elements within the view over each other.

Child views are drawn in a stack, with the most recently added child on top. The size of the FrameLayout is the size of its largest child (plus padding), visible or not (if the FrameLayout's parent permits). Views that are GONE are used for sizing only if setConsiderGoneChildrenWhenMeasuring() is set to true.

Remi Smirra
  • 2,499
  • 1
  • 14
  • 15
0

I found a solution!
Use:

app:cardUseCompatPadding="true"

It creates a small margin around the cardview so the shadow always appears!

Found it here: xamarin
Also other nice things for card views! :)

Joestoen
  • 545
  • 1
  • 5
  • 14