我正在尝试以最简单的方式使图像循环显示。但这是行不通的。 我也尝试实现“ hdodenhof / CircleImageView”,它没有用。 有其他替代的可靠方法吗?
<com.google.android.material.card.MaterialCardView
android:layout_width="200dp"
android:layout_height="200dp"
app:cardCornerRadius="100dp">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/spongebob"/>
</com.google.android.material.card.MaterialCardView>
答案 0 :(得分:0)
尝试使用CircularImageView
库:
<com.mikhaellopez.circularimageview.CircularImageView
android:layout_width="250dp"
android:layout_height="250dp"
android:src="@drawable/spongebob"
app:civ_border_color="#ffffff"
app:civ_border_width="2dp"
app:civ_shadow="true"
app:civ_shadow_radius="5"
app:civ_shadow_color="#ff9999"/>
以及在build.gradle中:
implementation 'com.mikhaellopez:circularimageview:3.2.0'
答案 1 :(得分:0)
您看过ImageView in circular through xml还是 使用Henning Dodenhof创建的库CircularImageView。您只需要在xml中写几行代码
<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/profile_image"
android:layout_width="96dp"
android:layout_height="96dp"
android:src="@drawable/profile"
app:civ_border_width="2dp"
app:civ_border_color="#FF000000"/>