-3

Why there is spaces in the bottom part of the android it was supposed to cover up all the spaces by distributed weight

enter image description here

rafsanahmad007
  • 23,683
  • 6
  • 47
  • 62

2 Answers2

0

You have to set an weightSum value by using attribute android:weightSum="value" to LinearLayout.

Try thise:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:weightSum="17">

    <ImageView
        android:src="@drawable/ocean"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:scaleType="centerCrop"
        android:layout_weight="5"/>

    <TextView
        android:text="You're Invited"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:textColor="@android:color/white"
        android:textSize="54sp"
        android:background="#009688"
        android:layout_weight="10"/>

    <TextView
        android:text="Bonfire at the beach"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:textColor="@android:color/white"
        android:textSize="34sp"
        android:background="#009688"
        android:layout_weight="2"/>

</LinearLayout>

OUTPUT:

enter image description here

Ferdous Ahamed
  • 21,438
  • 5
  • 52
  • 61
-1

Change height of textview to fill_parent

android:height="fill_parent"