I have started learning android yesterday from Udacity and have no prior experience in coding or programming. I want this image to fill all the gap and stretch out. Where am I going wrong?
Asked
Active
Viewed 98 times
-1
-
1Possible duplicate of [Android ImageView Fixing Image Size](https://stackoverflow.com/questions/12049626/android-imageview-fixing-image-size) – Reaz Murshed Jun 07 '19 at 14:14
-
NEVER post images of code! [mcve] – Rob Jun 08 '19 at 01:34
4 Answers
2
Use match parent as width and height to fit parent container (screen) and scaleType = fitXY
To make image fit all size
Like this code below:
<imageView
android:src="@drowble/mountains"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:layout_weight="1"/>

Adel B-Lahlouh
- 1,059
- 1
- 8
- 20
0
In your ImageView tag , you can use android:scaleType = "manyOptions"
.
Scroll through the possible option and choose the one that is right for you.

Sotiris S. Magionas
- 759
- 6
- 25
0
You must to use scaleType https://developer.android.com/reference/android/widget/ImageView.ScaleType
In your case try android:scaleType="fitXY"or android:scaleType="centerCrop"
Visual guide: https://thoughtbot.com/blog/android-imageview-scaletype-a-visual-guide

bask0xff
- 145
- 4
- 13
0
You can use it like this
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"/>

Suraj
- 165
- 2
- 11