0
如何让ListView
填充屏幕并同时移动下面的视图直到它到达底部?例如,在下面的图片中,我想让'创建'按钮在添加新元素时向下移动屏幕,然后当按钮到达底部时,ListView开始滚动(创建按钮仍然出现在屏幕上屏幕)。将更多元素添加到ListView时,视图向下移动
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
>
<ListView
android:id="@+id/galleryList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:layout_alignParentTop="true"
/>
<LinearLayout
android:id="@+id/lowerButtonLayout"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:background="#ffa8269f"
android:layout_alignParentBottom="true"
xmlns:android="http://schemas.android.com/apk/res/android">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/button_button_bg_colour"
android:onClick="addRow"
android:text="Create"/>
</LinearLayout>
</RelativeLayout>
创建一个自定义xml并将其添加为ListView的页脚。而且您必须将ListView高度设置为fill_parent。 – 2014-09-06 12:19:56
@dpsingh - 希望这可以通过布局完成 – Ian 2014-09-06 12:21:31
另一种方法是在ScrollView中使用ListView。 – 2014-09-06 12:40:37