• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Android ImageView causing whitespace at the bottom

My code below is causing a whitespace at the bottom of the image. I wanted the image to cover the entire screen, but somehow it isn't.

Code:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">

<RelativeLayout android:layout_width="match_parent"
                android:layout_height="match_parent">

    <ImageView
        android:src="@drawable/ohm"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:adjustViewBounds="true"/>

    <ImageView
        android:id="@+id/logo"
        android:src="@drawable/test2"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dp"/>

    <ImageView
        android:id="@+id/night"
        android:src="@drawable/night"
        android:layout_width="340dp"
        android:layout_height="250dp"
        android:layout_below="@id/logo"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="10dp"/>

    <EditText
        android:id="@+id/username"
        android:layout_width="340dp"
        android:layout_height="50dp"
        android:layout_centerHorizontal="true"
        android:layout_below="@id/night"
        android:layout_marginTop="20dp"
        android:alpha="0.2"
        android:background="@drawable/rounded_edittext_states"
        android:textColor="#D69E29"
        android:textStyle="bold"
        android:paddingLeft="15dp"
        android:hint="USERNAME"
        android:textColorHint="#D69E29"/>

    <EditText
        android:id="@+id/password"
        android:layout_width="340dp"
        android:layout_height="50dp"
        android:layout_centerHorizontal="true"
        android:layout_below="@id/username"
        android:layout_marginTop="10dp"
        android:alpha="0.2"
        android:background="@drawable/rounded_edittext_states"
        android:textColor="#D69E29"
        android:textStyle="bold"
        android:paddingLeft="15dp"
        android:hint="PASSWORD"
        android:textColorHint="#D69E29"/>

</RelativeLayout>
</ScrollView>

I've tried changing to different scaleType but it is still the same. Then, if I change the adjustViewBounds to false, the image will become double in height.

Below images are the 2 issues I am facing.
BOM5Cfe.png
Fe5WMoQ.png
 
Back
Top Bottom