Я использую CardView внутри RecyclerView. Прочитав много, я получил код «НЕ РАБОТАЕТ» только на Android 5.1.1. На Android-версии до этого он работает хорошо.Карт-аут не работает на Android 5.1.1
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#11ffffff"
android:orientation="vertical"
android:paddingBottom="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#11ffffff">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/primary_bg_light"
card_view:cardCornerRadius="2dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/primary_bg_light">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:paddingBottom="15dp"
android:paddingLeft="15dp"
android:textColor="@color/background_floating_material_light"
android:textSize="24sp"
android:textStyle="bold" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
</LinearLayout>
Я попробовал установку высоты используя код тоже но такой же результат.
Извините, я не вижу, где вы установили возвышение в этом коде. –
где атрибут 'card_view: cardElevation'? – Blackbelt
также, родительский 'RelativeLayout' для' CardView' выглядит избыточным. Я думаю, что фон # 11ffffff почти черный, и тень карты может быть не видна, когда вы устанавливаете высоту –