简体   繁体   中英

How to add a fixed LinearLayout below a scrollable ListActivity

what is the easiest way of achieving the following please? I've got a ListActivity which lists a number of search results. The look of the results is an XML specified LinearLayout. The results can go into thousands so I display only a number at a time, say 100. To open next page of results the user needs to click the hardware menu button and click 'Next' from there. I would however like a fixed LinearLayout on the bottom of results with always always visible navigation buttons. How can I do this? Do I somehow nest the XML layouts? Thanks!

You should have something like this:

LinearLayout - vertical, fill_parent in height, and non-scrollable
   LinearLayout - vertical, fill_parent in height, scrollable. this will hold the scrolling list
   LinearLayout - horizontal, wrap_content in height

Use Something like below. instead of using menu to see next page records. use the last cell of list as view more record button and on click of that add new records and notify the dataset changed.

Search a free app by name starr partners over android market. on the 2nd screen of app you will see a search result list with header and view more records last cell..

Check the code below

 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout android:id="@+id/relativeLayout1"
android:layout_width="fill_parent" android:layout_height="fill_parent"

xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:layout_height="45dip" android:layout_alignParentTop="true"
    android:background="#333333"
    android:id="@+id/linearLayout1" android:layout_width="fill_parent"></LinearLayout>
<LinearLayout android:layout_height="45dip" android:layout_alignParentBottom="true"
    android:background="#555555"
    android:id="@+id/linearLayout2" android:layout_width="fill_parent"></LinearLayout>


<ListView android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_below="@+id/linearLayout1"
    android:layout_above="@+id/linearLayout2"
    android:background="#CCCCCC"
     android:id="@+id/listView1"></ListView>


  </RelativeLayout>

Hope this help :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM