android - 圆角透明渐变安卓故障
问题描述
我有一个包含 ImageViews 的项目的 RecyclerView,我想在其上显示渐变阴影。显示一些文字。我尝试过带有圆角的可绘制形状的视图,我尝试过使用 ShapeableImageView,我尝试过使用卡片视图。它们都会导致角落变色的相同奇怪图形故障。
这是我的可绘制视图
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/card_corner_radius" />
<gradient
android:endColor="@color/card_shadow_bottom"
android:startColor="@color/card_shadow_top"
android:angle="270"
android:type="linear" />
</shape>
这是我的项目布局
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/iv_image"
imageUrl="@{obj.imageUrl}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/content_image_description"
android:scaleType="centerCrop" />
<View
android:id="@+id/v_card_shadow"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/card_shadow"
app:layout_constraintBottom_toBottomOf="@+id/iv_image"
app:layout_constraintEnd_toEndOf="@+id/iv_image"
app:layout_constraintStart_toStartOf="@+id/iv_image"
app:layout_constraintTop_toTopOf="@+id/iv_image" />
</androidx.constraintlayout.widget.ConstraintLayout>
是什么原因造成的?我该如何解决?
解决方案
推荐阅读
- winscp - 由用户终止。复制文件严重失败。将文件复制到远程端失败
- angular - Angular 6 Form Array Patch 值更改时的值
- php - Running function on WooCommerce refund causes 500 error
- hyperledger-fabric - 查询其他会员证书
- apache-camel - 带有 JSONPath 过滤器表达式的 Camel CBR,获取 InvalidPathException
- sql - 2 列值在单独的列中为一行
- android - 上传应用程序以播放商店 alpha 曲目后立即获取崩溃报告
- ios - 在 iOS 上未原生找到 RNFirebase 核心模块 - 未修复
- node.js - 使用 Supertest 时出现 500“内部服务器错误”
- blockchain - 制作智能合约跟踪汇率并只接受设定值的付款