如何解决Android:ImageView背景不会改变
我在ContraintLayout中具有以下ImageView:
<ImageView
android:id="@+id/app_logo"
android:layout_width="96dp"
android:layout_height="96dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:contentDescription="@string/app_name"
android:src="@mipmap/app_icon"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/about"
app:srcCompat="@drawable/app_logo" />
app_logo
是具有透明背景的nodpi PNG。我已经检查过了,它是透明的。
无论我设置了与背景相关的属性,我总是在图像后面出现白色的松鼠。 (我想形状可能来自一个UI)。
我想念什么?我的应用程序中有几个ImageView,其中每个都有我需要的背景,除了这一个。这让我发疯。
解决方法
您是否尝试过摆脱android:src="@mipmap/app_icon"
行?您可能不应该在布局XML中引用Mipmap。而且,此外,您已经有srcCompat
指向另一张图片。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。