title: Image on xml in Android Studio stretches abnormally height wise
body: <p>Edit: The problem with my image is of resolution so higher the resolution the more blank space there is. But I can't get the right resolution. If the resolution is too high the problem is right here and if it is enough to fit the image to a 720p display then the image quality is so bad on QHD or higher displays. I can't seem to find any other solution on the internet other than the resolution thing so please help!</p>
  
  <p>The image I put on XML has no visible layout_marginVertical. I did not put that attribute there and if I do write that it does put that margin vertically resulting in a confused situation. This happens even though I wrapped all the content. This is the image I inserted in my code:</p>
  
  <p><a href="https://i.stack.imgur.com/Jxm15.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jxm15.jpg" alt="Image"></a> </p>
  
  <p>And this is the result I get:</p>
  
  <p><a href="https://i.stack.imgur.com/dsptw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dsptw.png" alt="![result"></a></p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/drawer_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="?attr/backgroundcolor"
      tools:context=".RegistrationActivity"&gt;
  
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"&gt;
  
          &lt;androidx.appcompat.widget.Toolbar
              android:id="@+id/toolbar"
              android:layout_width="match_parent"
              android:layout_height="?attr/actionBarSize"
              android:background="@color/colorPrimary"
              android:elevation="4dp"
              android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
              app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /&gt;
  
          &lt;ScrollView
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_below="@+id/toolbar"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical"
                  android:padding="10dp"&gt;
  
                  &lt;androidx.cardview.widget.CardView
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"&gt;
  
                      &lt;ImageView
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:src="@drawable/android_course_thumbnail"
                          android:layout_marginBottom="20sp"/&gt;
  
                  &lt;/androidx.cardview.widget.CardView&gt;
  
              &lt;/LinearLayout&gt;
  
          &lt;/ScrollView&gt;
  
      &lt;/RelativeLayout&gt;
  
      &lt;com.google.android.material.navigation.NavigationView
          android:id="@+id/nav_view"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          android:background="?attr/backgroundcolor"
          app:headerLayout="@layout/navigation_header"
          app:menu="@menu/navigation_menu" /&gt;
  
  &lt;/androidx.drawerlayout.widget.DrawerLayout&gt;
  </code></pre>