-1

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?

enter image description here

frobinsonj
  • 1,109
  • 9
  • 21
brownputin
  • 79
  • 5

4 Answers4

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.

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