android - 如何在 glide 4 中为圆形裁剪图像制作阴影

标签 android android-glide

我在 glid4 中使用 RoundedCorners 方法制作的个人资料图片非常扁平,我的个人资料没有任何阴影。我如何为我的图像配置文件设置阴影?glid4 对此有任何方法,或者我必须创建一个? enter image description here

最佳答案

实现“com.github.bumptech.glide:glide:4.10.0”

XML

<FrameLayout
    android:id="@+id/fl_image"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_margin="10dp"
    android:background="@drawable/card_circle_background"
    android:elevation="8dp">

    <ImageView
        android:id="@+id/iv_item_employee"
        android:layout_width="60dp"
        android:layout_height="60dp"
        tools:background="@color/colorPrimary" />
</FrameLayout>

形状可绘制

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="oval">
     <solid android:color="@color/white"/>
</shape>

Glide 配置

Glide.with(this)
    .asBitmap()
    .load(item.image)
    .apply(RequestOptions.circleCropTransform())
    .into(iv_item_employee)

关于android - 如何在 glide 4 中为圆形裁剪图像制作阴影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49400855/

相关文章:

机器人 : developer options hidden

android - Firebase Storage UI 和 Glide 不显示图像

java - 用于 base64 图像的自定义 Glide ModelLoader

android - 使用 Glide 在 RecyclerView 中加载图像时,UI 滞后且不稳定

android - Glide 。缓存到外部存储(SD 卡)

Android获取Facebook共同好友如何填写USER ID?

Android 文本在某些设备上被截断

java - 安卓工作室 : Unable to find explicit activity class but activity already declared in AndroidManifest. xml

android - 带有文本选择控件的 float 工具栏

android - Flutter - SQFlite - 类型 'String' 不是类型 'double' 的子类型