I want that my image size is exactly the size of parent element
I already use this "android:adjustViewBounds="true"" but its not working. I try many times but fail
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".6">
<ViewFlipper
android:id="@+id/viewflipper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoStart="true"
android:flipInterval="2000" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
android:src="@drawable/ic_launcher_background" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:src="@drawable/background" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/background" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/background" />
</ViewFlipper>
</RelativeLayout>
Try combine your ImageView with scaleType and adjustViewBounds like this:
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/ic_launcher_background" />
You can use fitXY | centerCrop | fitCenter and others
See more options for scaleType here:
https://developer.android.com/reference/android/widget/ImageView.ScaleType