Why there is spaces in the bottom part of the android it was supposed to cover up all the spaces by distributed weight
Asked
Active
Viewed 162 times
-3

rafsanahmad007
- 23,683
- 6
- 47
- 62

Abdullah Noman
- 59
- 9
-
1post your code and if possible an image of your problem, also you can activate the "Show layout bounds" option from developers options on your phone. – Jonathan Aste May 02 '17 at 18:25
-
Add the XML code to Question(not the image of the code) image is good for result – Gajendra Singh Rathore May 02 '17 at 18:37
-
Post your xml code here – Ferdous Ahamed May 02 '17 at 18:42
2 Answers
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:

Ferdous Ahamed
- 21,438
- 5
- 52
- 61
-1
Change height of textview to fill_parent
android:height="fill_parent"

Gajendra Singh Rathore
- 73
- 10