2011-11-01 61 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