How do I get the coordinates of an image size in Android? -
i want coordinates image selected gallery. when go gallery , select image, image shown on screen.
the problem application gets screen size, not image size.
relevant code:
targetimage.setontouchlistener(new imageview.ontouchlistener(){ public boolean ontouch(view v, motionevent event) { // todo auto-generated method stub int x = (int) (event.getx() * imagewidth / v.getwidth()); int y = (int) (event.gety() * imageheight / v.getheight()); textview.settext("touch coordinates : "+string.valueof(event.getx())+" x "+string.valueof(event.gety())); imageview imageview = ((imageview)v); bitmap bitmap = ((bitmapdrawable)imageview.getdrawable()).getbitmap();
use line of code
imageview.setscaletype(imageview.scaletype.fit_xy);
Comments
Post a Comment