Reputation: 111
I have image in drawable, which needs to work as the background. It needs to stretch to fill the screen.. I know how to stretch the image full screen using java code.. but in XML itselt how can do this.
Upvotes: 8
Views: 11147
Reputation: 1
I prefer to use scaleType="centerCrop". This way the image isn't stretched out of its original proportions.
Upvotes: 0
Reputation: 1238
Try to implement your ImageView like this and change the ic_launcher to your own image name which you are trying to add.
<ImageView
android:id="@+id/mImageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:src="@drawable/ic_launcher" />
Hope this will be helpful. Thanks
Upvotes: 5
Reputation: 4569
android:scaleType="fitXY"
will stretch the image to fit the full size of the ImageView
Upvotes: 16
Reputation: 920
Try with this property:
android:scaleType="fitXY"
Here you can find other constant values for resizing.
Upvotes: 5