How to stretch the image to the entire layout?

  • 0
    In general, I want the text to be in the picture, everything is ok, only, there are white gaps above and below, if you insert 1 picture without a layout, then everything is ok. What if there is a layout?

    <RelativeLayout 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"
        android:background="@color/colorWhite"
        tools:context="com.example.a1.tutorial.fragments.FragmentDiscription">
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="false"
            android:id="@+id/imageDiscription" />
    
        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentBottom="true"
            android:background="@color/colorWhite"
            android:scaleType="centerCrop"
            android:textColor="@color/colorBlack"
            android:textSize="20sp"
            android:textStyle="bold"
            android:id="@+id/discription"/>
    
    </RelativeLayout>
    Android August Fitzgerald, Oct 10, 2019

  • 1 Answers
  • 0
    Layout is always there.

    You yourself set the height and width of the wrap_content to the image. Make match_parent.
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!