匿名用户
我想这就是你想要的,我测试这个并按照你的预期工作。<?xml version="1.0" encoding="utf-8"?>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/your_image" />
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
card_view:cardBackgroundColor="@color/transparent"
card_view:cardCornerRadius="5dp"
card_view:cardElevation="0dp"
card_view:cardMaxElevation="0dp"
card_view:cardPreventCornerOverlap="false"
card_view:cardUseCompatPadding="true"
card_view:contentPaddingTop="2dp">
android:id="@+id/list_container_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/your_gradient"
android:gravity="center"
android:orientation="vertical">
这是渐变背景文件your_gradient.xml<?xml version="1.0" encoding="utf-8"?>
android:startColor="#80000000"
android:endColor="#FF000000"
android:angle="270"
android:dither="true"
/>