Reputation:
My layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/skyblue" >
<TextView
android:id="@+id/tvPlaceHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/places"
android:layout_margin="10dp"
android:layout_gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:contentDescription="@string/search"
android:id="@+id/ivPlace"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/logo" />
<TextView
android:contentDescription="@string/search"
android:id="@+id/tvTrivia"
android:textSize="14sp"
android:textStyle="bold"
android:layout_margin="10dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/search" />
</LinearLayout>
</ScrollView>
The screenshot:
My question is, why is it not covering the whole layout? I mean it has a white space below but I declared in my xml to have its background color as blue.
Upvotes: 1
Views: 1482
Reputation: 13805
Remove this line android:background="@color/skyblue" from LinearLayout and write in ScrollView
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/skyblue"
>
Upvotes: 0
Reputation: 9580
Change your inner LinearLayout height
<LinearLayout
android:layout_width="match_parent"
android:layout_height="fill_parent" // CHANGED LINE
android:orientation="vertical"
android:background="@color/skyblue" >
Upvotes: 1