Guest User

Untitled

a guest
Jan 16th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment