I use the following code to show my button
(Because I need to add the text on the button, so I will not use the ImageButton)
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/bottom001"
android:adjustViewBounds="true"
android:scaleType="fitXY"/>
</RelativeLayout>
But the ImageView will have some empty area in the View
I think "fitXY" will fill the View, but it didn't
How can I do in this case?
Thanks for your help :)
set android:layout_width="wrap_content"
And Use LinearLayout
Finally
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/test"
android:adjustViewBounds="true"
android:scaleType="fitXY"/>
For details please read android-imageview-scaletype-samples
Scale the image using FILL.Stretch the picture inside the available width and height, disgarding the aspect ratio.