当触摸一个 ImageView 时,我需要在 android 中的另一个 ImageView 中显示触摸区域?

When touch an ImageView i need to display the touched area in another ImageView in android?

我用了这个方法:

croppedBitmap =Bitmap.createBitmap( sourceBitmap, x, y, 80, 80, mMatrix, true);

但在角落区域显示错误:

java.lang.IllegalArgumentException: x must be >= 0

所附图片显示了我的预期结果

   ImageView imageView = (ImageView) findViewById(R.id.iv_imageview);
   imageView.setOnTouchListener(new OnTouchListener(){

   @Override
   public boolean onTouch(View v, MotionEvent event) {
    int topParam =  imageView.getPaddingTop();
    int rightParam =  imageView.getPaddingRight();
    int maxTopParam = topParam+imageView.getMaxHeight();
    int maxRightParam = rightParam + imageView.getMaxWidth();
     if(event.getX>topParam&&event.getX<maxTopParam){
        //the x coordinate is in your image... do the same to Y
     }
      });
    return true;
    }