<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rl_root" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/myImage" android:layout_width="match_parent" android:layout_height="match_parent" android:adjustViewBounds="true" android:background="@android:color/black" android:src="@drawable/image2" /> <View android:id="@+id/view_clickable_first" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#aa000000" /> </RelativeLayout> I want to make a small part of image in Imageview(myImage) clickable after getting coordinates. Its working fine for me. Now I want to get the functionality of pinch zoom on this image. As I zoom in, clickable area along with the image will also zoom and accordingly.
My problem is that, I want to get height of image in ImageView (excluding black spaces in top and bottom. As ImageView is set to match parent, Image is showing in center of the screen in landscape mode). EveryTime I am getting height of imageview.
My code for getting height of image and imageview:
int imagWidth = imageView.getWidth(); int h = imageView.getHeight(); int w = imageView.getDrawable().getIntrinsicWidth(); int imagHeight = imageView.getDrawable().getIntrinsicHeight(); Log.e("height", "Image height" + imagHeight + "\n" + "Imageview height" + h); So as per calculation: Image height= 882 Imageview height = 672
ImageView#getDrawable()methodint w = imageView.getDrawable().getIntrinsicWidth(); int imagHeight = imageView.getDrawable().getIntrinsicHeight();Its not workingDrawablethat is shown