Same layout, but rendering differently between L and all other versions.
4.1.2
5.0
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:background="#FFFFFFFF"
android:elevation="40dp"
android:padding="0dp"
android:translationZ="0dp"
app:cardBackgroundColor="#FFFFFFFF"
app:cardCornerRadius="2dp"
app:cardElevation="40dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true"
app:contentPadding="10dp" >
<TextView
android:layout_width="wrap_content"
android:gravity="center_horizontal"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:background="#FFFFFFFF"
android:text="TEXTVIEW" />
</android.support.v7.widget.CardView>
This is working as intended. The shadows pre-L are "simulated". From the documentation "CardView uses elevation property on L for shadows and falls back to a custom shadow implementation on older platforms." There are other compatibility concerns there you should read about. Particularly, make sure to set useCompatPadding to true for consistency.
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