【问题标题】:Circle Image View shows square images圆形图像视图显示方形图像
【发布时间】:2021-03-17 18:16:25
【问题描述】:

我想添加一个 circleimageview 和文本视图的列表,并在回收站视图中使用它,但它显示了像这样的方形图像,但我想显示一个圆形图像

<?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>

另外,我添加了圆形图像视图的依赖项

implementation 'de.hdodenhof:circleimageview:3.1.0'

帮我找出这段代码中的错误

【问题讨论】:

  • 您确定它在部署到设备后显示为正方形吗?它可能在设计视图中显示方形
  • 非常感谢它在设备上部署后显示的评论

标签: android android-layout android-imageview circleimage


【解决方案1】:

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

【讨论】:

  • 感谢您回答我,但在强制刷新后应用部署出现另一个问题,显示圆形图像
【解决方案2】:

重建您的项目并确保在重建之前您的 build.gradle 已成功添加到项目中。并在项目正常工作后清除缓存

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-06-27
    • 1970-01-01
    • 2019-05-25
    • 1970-01-01
    • 1970-01-01
    • 2019-05-13
    • 2023-03-23
    相关资源
    最近更新 更多