更改ImageView中黑色像素的不透明度

问题描述 投票:0回答:1

App State现在

我正在制作一个应用程序,其中我希望背景风景/图片仅在黑色草图中可见,并且图像部分的重置应保持不透明。现在我已经使前面的Imageview对某些值透明,但这不是我想要的,我只想改变黑色像素的不透明度。

ImageView frontImageView = findViewById(R.id.image);
Bitmap front = BitmapFactory.decodeResource(getResources(), 
R.drawable.front);
front=GrayscaleToBin(front);
front.setHasAlpha(true);
frontImageView.setImageBitmap(front);
imageView.setImageAlpha(150);

我搜索了很多,但找不到解决这个问题的方法。任何帮助表示赞赏。

android bitmap imageview overlay opacity
1个回答
0
投票

我建议从其他工具(如Paint或Photoshop等)更改原始图像,然后在应用程序中加载图像。

由于您对当前图像进行更改将再次花费一些时间来加载不必要的内容。

在其他第三方工具中更好地处理图像并在应用程序中使用。

© www.soinside.com 2019 - 2024. All rights reserved.