如何读取imageview中的像素颜色并显示像素颜色的消息? [英] how to read the pixel color in imageview and show message of pixel color ?
本文介绍了如何读取imageview中的像素颜色并显示像素颜色的消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何读取imageview中的像素颜色并显示像素颜色的消息?
how to read the pixel color in imageview and show message of pixel color ??
推荐答案
获取 ImageView的触摸像素颜色,你应该实现 ImageView 的OnTouchListener
,通过调用event.getX()获得触摸位置
和event.getY()
,并通过调用bitmap.getPixel(x,y)获取像素颜色
。
请遵循以下代码示例:
获取ImageView的像素颜色 [ ^ ]
To get touched pixel color of an ImageView, you should implementOnTouchListener
of the ImageView, get touched position by callingevent.getX()
andevent.getY()
, and get the pixel color by callingbitmap.getPixel(x, y)
.
Follow this code example:
Get touched pixel color of ImageView[^]
这篇关于如何读取imageview中的像素颜色并显示像素颜色的消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文