答案 0 :(得分:1)
尝试
imageView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent ev) {
// TODO Auto-generated method stub
ImageView img = (ImageView) v;
final int evX = (int) ev.getX();
final int evY = (int) ev.getY();
img.setDrawingCacheEnabled(true);
Bitmap imgbmp = Bitmap.createBitmap(img.getDrawingCache());
img.setDrawingCacheEnabled(false);
try {
int pxl = imgbmp.getPixel(evX, evY);
pickedColorView.setBackgroundColor(pxl);
int redValue = Color.red(pxl);
int blueValue = Color.blue(pxl);
int greenValue = Color.green(pxl);
}catch (Exception ignore){
}
imgbmp.recycle();
return true;
}
});