I have set an image in imageview. It is showing in center of the screen as I have make its parent layout (Relative layout) to match parent. Imageview height and width is also set to match parent.
I want to get the height and width of Image in imageview.
I have used :
int imagWidth = imageView.getWidth();
int imagHeight = imageView.getHeight();
but by this we are getting height and width of Imageview .
Here is my xml:
<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/imag"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:background="@android:color/black"
android:src="@drawable/image2" />
</RelativeLayout>