开发者

Layout with list

I have a listactivity with the following layout-xml

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayou开发者_运维技巧t 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


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.


Yes, just add a button above the ListView.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜