2011-03-13 48 views
0

實現以下目標的最簡單方法是什麼?我有一個ListActivity列出了一些搜索結果。結果的外觀是一個XML指定的LinearLayout。結果可能會變成數千,所以我一次只顯示一個數字,例如100.要打開結果的下一頁,用戶需要點擊硬件菜單按鈕並從那裏點擊「下一步」。然而,我想要一個固定的LinearLayout在結果的底部總是總是可見的導航按鈕。我怎樣才能做到這一點?我是否以某種方式嵌套XML佈局?謝謝!如何在可滾動的ListActivity下面添加固定的LinearLayout

回答

1

你應該有這樣的事情:

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 
+0

謝謝您幫幫我。我現在很忙,但當我有時間並回應時,我會看看你的解決方案。 – TomaszRykala 2011-03-15 11:05:55

1

使用類似下面。而不是使用菜單查看下一頁記錄。使用列表的最後一個單元格作爲查看更多記錄按鈕,並點擊添加新記錄並通知已更改的數據集。

搜索一個免費的應用程序名稱starr合作伙伴在Android市場。應用程序的第二個屏幕上,你會看到標題搜索結果列表並查看更多記錄最後一個單元格..

檢查下面

<?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> 

希望這個代碼幫助:)

+0

謝謝你的幫助。我現在很忙,但當我有時間並回應時,我會看看你的解決方案。 – TomaszRykala 2011-03-15 11:06:39