android - 圆形 ImageView 显示方形图像

标签 android android-layout android-imageview circleimage

我想添加一个 circleimageview 和 TextView 的列表并在回收器 View 中使用它,但它向我显示了像这样的方形图像,但我想显示一个圆形图像
enter image description here

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="horizontal"
    android:padding="16dp"
    android:background="@drawable/category_bg"
    android:layout_margin="4dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <de.hdodenhof.circleimageview.CircleImageView
        android:id="@+id/image_view"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:src="@color/purple_200" />
        <TextView
        android:id="@+id/title"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_marginStart="8dp"
        android:layout_marginEnd="8dp"
        android:layout_weight="1"
        android:text="Title"
        android:textColor="@color/black"
        android:textStyle="bold"
        android:textSize="18sp"
        android:gravity="center_vertical"
        android:padding="8dp"
        />

</LinearLayout>
另外,我添加了圆形 ImageView 的依赖项
implementation 'de.hdodenhof:circleimageview:3.1.0'
帮我找出这段代码中的错误

最佳答案

请重建您的项目并确保其在 build.gradle 中的实现已成功添加到项目中:
enter image description here

关于android - 圆形 ImageView 显示方形图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65164819/

相关文章:

java - Jersey Web 服务中的 PathParam 值为 null

java - 在 EditText 上调用 setCustomSelectionActionModeCallback() 后如何修复上下文菜单栏功能(复制/粘贴等)?

android - 是否可以在 Eclipse 中预览 AppWidget 的布局?

android-layout - 贺卡翻页动画

android - 为什么图像是重复的( picasso )

android - 将 ImageView 与布局中心向左对齐 10dp

android - 尽管从非 UI 线程从 TelephonyManager 注销,监听器仍被调用

android - Material TextAppearance 对处理不同的 textSize 有用吗

android - 自定义滑动解锁

android - ImageView 没有保持最大高度和宽度