当图像旋转时,如何检测图像的哪一部分被触摸?

2024-01-04

我有一张像这样的图片。我可以使用旋转它这段代码 https://stackoverflow.com/questions/4414819/android-rotating-an-imageview-with-finger-moves-other-views-around。现在我想知道,无论方向盘的位置如何,都触摸了哪种颜色。例如,无论轮盘处于以下哪个位置,我都应该能够检测到我触摸的颜色......红色、黄色、绿色、蓝色、粉色或灰色。

是否可以?我该怎么做?

除了使用一张图片之外,还有其他可能性吗?(我宁愿避免的解决方案......)

enter image description here or enter image description here or enter image description here or whatever...

更新:我发布了一些颜色,因为我想更清晰,并且我找到了解决方案,但是如果我有不同的图像而不是颜色,我该怎么办。


解码触摸事件的 x 和 y 位置,然后在 Bitmap 上调用 getPixel:http://developer.android.com/reference/android/graphics/Bitmap.html http://developer.android.com/reference/android/graphics/Bitmap.html

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

当图像旋转时,如何检测图像的哪一部分被触摸? 的相关文章

随机推荐