答案 0 :(得分:2)
替代解决方案: -
使用自定义drawable并将其设置为imageview background shadow.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<solid android:color="@color/gray"/>
<!--shadow Color-->
</shape>
</item>
<item
android:left="0dp"
android:right="0dp"
android:top="0dp"
android:bottom="3dp">
<shape android:shape="oval">
<solid android:color="@color/lightgrey"/>//your background color here
</shape>
</item>
</layer-list>
像这样使用它: -
android:background="@drawable/shadow"
另一种解决方案你可以尝试: - https://github.com/Pkmmte/CircularImageView
此库可用于您的要求
答案 1 :(得分:2)
实现“ 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.with(this)
.asBitmap()
.load(item.image)
.apply(RequestOptions.circleCropTransform())
.into(iv_item_employee)
答案 2 :(得分:0)
您可以选择Fresco
的{{1}}工具: -
以XML格式: -
facebook
或通过以下代码: -
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/avatar_image"
android:layout_width="@dimen/message_avatar_image_size"
android:layout_height="@dimen/message_avatar_image_size"
android:paddingRight="@dimen/spacing_half"
fresco:roundAsCircle="true" />
更多信息here