タッチされたピクセルの色を取得し、この色を背景色として FrameLayout に設定しようとしていますが、機能しません。なぜ?
これが私のコードです:
@Override
public boolean onTouch(View v, MotionEvent event) {
float xPos = event.getX();
float yPos = event.getY();
ImageView iview = (ImageView)v;
Bitmap bitmap = ((BitmapDrawable)iview.getDrawable()).getBitmap();
int color = bitmap.getPixel(Math.round(xPos), Math.round(yPos));
myFrameLayout.setBackgroundColor(Integer.parseInt(Integer.toString(color), 16));
return true;
}