I have the following rectangular image to be set in my application.

Now I am trying to expand the image with same ratio on both sides until it fits to the screen.But I cant get the expected image.

So far my code is :
<ImageView
android:id="@+id/imgid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/shayneward"
android:scaleType="fitXY"/>
It dont care that the image gets cut off, but it should expand on both sides with same ratio until it fits to the screen.
Change
android:scaleType="fitXY"toandroid:scaleType="centerCrop"to get the behavior that you want.The different scaling options are documented under ImageView.ScaleType.