Lena Bru
Lena Bru

Reputation: 13947

How to make objects be in the bottom of a scrollview

I have a scrollview with a root view which is Linear Layout

at the bottom of the LinearLayout there is a button

I want it to scroll up with the scroll view, but when the view first appears on the screen I want the button to be at the bottom of the view and it's not

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/default_side_margin"
        android:layout_marginRight="@dimen/default_side_margin"
        android:orientation="vertical" >


        <include
            android:id="@+id/details"
            layout="@layout/layout_details"
             />

        <include
            android:layout_gravity="bottom"
            layout="@layout/layout_btn_next" />
    </LinearLayout>
</ScrollView>

the first included layout takes up only about half the screen

I want the button to scroll up with the layout , but be far enough from layout details to be on the bottom of the screen

Upvotes: 1

Views: 87

Answers (1)

Evgeni Roitburg
Evgeni Roitburg

Reputation: 2097

Didnt fully understand your question but you should try android:fillViewport=true on a scrollview, look here: http://www.curious-creature.org/2010/08/15/scrollviews-handy-trick/

Upvotes: 1

Related Questions