Roland
Roland

Reputation: 5438

Layout with list

I have a listactivity with the following layout-xml

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    xmlns:myapp="http://schemas.android.com/apk/res/se.javalia.myDrinks"
    >
    <Button android:id="@+id/saveButton" 
        android:text="test test" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" />
    <ListView  
        android:id="@+id/android:list"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" />
    <TextView 
            android:id="@+id/android:empty"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:text="@string/main_no_items" /> 
</LinearLayout>

Now, I'd like to add a button above the list that stays in place when the list is scrolled. Is it possible at all?

Thanks in advance Roland

Upvotes: 0

Views: 167

Answers (3)

Tom
Tom

Reputation: 2322

In your 1st LinearLayout you should add: android:orientation="vertical"

Upvotes: 1

McStretch
McStretch

Reputation: 20645

It's definitely possible, just add a Button before the ListView in your XML. If your View becomes more involved, I would change your LinearLayout to be a RelativeLayout, and then you can position the elements more easily.

Upvotes: 2

John J Smith
John J Smith

Reputation: 11923

Yes, just add a button above the ListView.

Upvotes: 2

Related Questions