G
G
goodTimes2017-03-24 20:29:00
Java
goodTimes, 2017-03-24 20:29:00

How to stretch an image to cover the entire layout?

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 image without a layout, then everything is ok. But 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>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2017-03-24
@goodtimes922

Layout is always there.
You yourself set the height and width of wrap_content to the picture. Make match_parent.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question