Yanshof
Yanshof

Reputation: 9926

how to force LinearLayout to fill the scrollView?

I created two level of layout (because some devices have small screen ) -

ScrollView that hold LinearLayout

For some reason i can't make the LinearLayout to fill all the ScrollView and when i work with big screen i see some gap below the LinearLayout

Please ... any help :)

Thanks

 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            tools:context=".MainActivity">

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        tools:showIn="@layout/activity_main"
        android:orientation="vertical"
        android:id="@+id/topLinearLayout"/>

Upvotes: 0

Views: 121

Answers (2)

Ben P.
Ben P.

Reputation: 54204

Add android:fill_viewport="true" to your ScrollView

Upvotes: 2

Yunus Kulyyev
Yunus Kulyyev

Reputation: 1022

Change the layout_width and layout_height on both scrollView and LinearLayout to wrap_content

Upvotes: 0

Related Questions