【问题标题】:ShapeableImageView has black overlayShapeableImageView 有黑色覆盖
【发布时间】:2020-08-14 22:00:15
【问题描述】:

我正在使用新的 ShapeableImageView 制作圆形图像,但叠加层显示为黑色。我怎样才能使它透明?这是它的样子:

这是代码:

<com.google.android.material.imageview.ShapeableImageView
        android:id="@+id/app_icon"
        android:layout_width="100dp"
        android:layout_height="100dp"
        app:layout_constraintBottom_toTopOf="@+id/guideline2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:shapeAppearanceOverlay="@style/CircleImageView"
        app:srcCompat="@mipmap/ic_launcher_round" />
<style name="CircleImageView">
        <item name="cornerFamily">rounded</item>
        <item name="cornerSize">50%</item>
    </style>

【问题讨论】:

  • 参考此链接:gist.github.com/gabrielemariotti/…,如果您仍然遇到任何问题,请说明您使用的是什么版本。
  • 1.2.0 和 1.2.1 出现同样的问题
  • 原来这只是一个预览问题,如果你运行应用程序你不应该看到黑色背景
  • 不知何故,我仍然在片段转换过程中看到了这一点。任何线索如何摆脱?

标签: android kotlin android-xml


【解决方案1】:

就像@Matteo Innnocenti 在 cmets 上提到的,这只是一个预览问题,当你运行应用程序时你不应该看到黑色背景

为了让更多人看到,我将其发布为答案

【讨论】:

    猜你喜欢
    • 2016-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-14
    • 2015-08-12
    • 2023-04-03
    • 2023-04-09
    • 2018-04-26
    相关资源
    最近更新 更多