2011-11-01 108 views
0

我有這個xml文件。該列表包含2個項目。當我在SDK模擬器或平板電腦上測試應用程序時,它顯示爲默認。但是,當我使用Android v2.2.1在Samsung GT-S5570上下載應用程序時,用戶可以從頂部拖動列表並將其移至屏幕的底部。有什麼辦法可以防止這種情況發生?android listview不會貼在佈局頂部

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 
    <ListView 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:paddingTop="20dip" 
     android:id="@android:id/list" 
     android:cacheColorHint="@android:color/transparent" 
     android:textAppearance="?android:attr/textAppearance"/> 
</RelativeLayout> 
+0

這可能是操作系統的默認行爲。 –

+0

這就是我所懷疑的,我認爲唯一的解決方法是使用ScrollView作爲Paresh的鏈接建議。 – iCantSeeSharp

回答

0

如果您只是想顯示有限數量的項目,然後將該項目放在ScrollView而不是使用ListView。

ListView旨在顯示無限數量的項目與滾動視圖滾動其他項目。

這個答案是更多的信息和幫助:how can i automatically size listview so it doesn't scroll

+0

我很明白。不過,我必須補充一點,我也看到了手機瀏覽器的下載管理器也發生了同樣的情況,所以我無法弄清楚這是否是一個糟糕的設計,其次是android開發人員,或者只是其他一些固定的行爲設備。 – iCantSeeSharp