您好,我创建了一个 listActivity,其中包含一些数据行,并且在屏幕底部(不是列表)我放了一个按钮。我的问题是如果我的列表已满,因此需要滚动以便看到其他行,按钮似乎是透明的并与列表的最后一个元素重叠。所以它看起来不太舒服。你对如何解决这个问题有什么建议吗?有什么方法可以让我的列表为底部按钮留出一些空间吗?我不想用页脚 View 来实现它。我将发布 xml 文件,以便您可以获得更清晰的图片。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<DragNDrop.DragNDropListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_weight="1" >
</DragNDrop.DragNDropListView>
<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:alpha="1"
android:drawableLeft="@drawable/back"
android:text="Return" />
</RelativeLayout>
最佳答案
试试这个
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:alpha="1"
android:drawableLeft="@drawable/back"
android:text="Return" />
<DragNDrop.DragNDropListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/btn" >
</DragNDrop.DragNDropListView>
</RelativeLayout>
在RelativeLayout中,元素默认放置在左上角,List无需指定
关于android-layout - 带有底部按钮的 ListActivity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11735490/