daily pastebin goal


a guest Jan 16th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. final ImageView iv_YourImage = (ImageView) findViewById(R.id.iv_imageview);
  2. public boolean onTouch(View v, MotionEvent event){
  3. int topParam =  iv_YourImage.getPaddingTop();
  4.  int rightParam =  iv_YourImage.getPaddingRight();
  5. int maxTopParam = topParam+iv_YourImage.getMaxHeight();
  6. int maxRightParam = rightParam + iv_YourImage.getMaxWidth();
  7.  if(event.getX>topParam&&event.getX<maxTopParam){
  8.     //the x coordinate is in your image... do the same to Y
  9.  }
  10. return true;
  11. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand