gpt4 book ai didi

android - 获得的位图是透明的,但是当设置为 ImageView 时变得不透明

转载 作者:太空宇宙 更新时间:2023-11-03 23:15:04 24 4
gpt4 key购买 nike

我正在使用 OpenCV 来实现一些简单的事情,如果 Mat 的像素 (x,y) 颜色等于白色,它就会变为透明 (alpha = 0)。之后将 Mat 转换为 bitmap

enter image description here

调试时返回的位图是正确的,但是当我将它设置为 imageview 时,返回的图像仍然是白色背景(与原始图像一样)而不是透明图像。

这是原图(白色背景)

enter image description here

调试图片,背景透明

enter image description here

请帮我解决一下:(

最佳答案

在您的 ImageView 中添加以下行,

android:background="@android:color/transparent"

关于android - 获得的位图是透明的,但是当设置为 ImageView 时变得不透明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41669185/

24 4 0
文章推荐: html - 在屏幕的水平和垂直中心放置一个
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com