【发布时间】:2021-07-15 10:05:34
【问题描述】:
我有一个带有滑动抽屉视图的应用程序。我的问题是,在抽屉活动布局中,我有一个列表视图,它到达滑动抽屉手柄所在的屏幕底部。所以无法看到列表中的最后一个元素,因为句柄与它重叠。 我该如何解决这个问题?
【问题讨论】:
标签: android
我有一个带有滑动抽屉视图的应用程序。我的问题是,在抽屉活动布局中,我有一个列表视图,它到达滑动抽屉手柄所在的屏幕底部。所以无法看到列表中的最后一个元素,因为句柄与它重叠。 我该如何解决这个问题?
【问题讨论】:
标签: android
我通过在列表视图底部添加空间解决了这个问题
通过以下步骤:
1.在布局文件夹中创建space_fotter.xml
space_fotter.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/color_appBackground">
<ImageView
android:gravity="center"
android:src = "@drawable/bg_white"
android:layout_width="10dp"
android:layout_height="50dp"
/>
</LinearLayout>
@drawable/bg_white 只是我创建的一个小的白色 png 文件。
2.从你的列表活动类中调用 space_fotter.xml
View SpaceFotter = getLayoutInflater().inflate(R.layout.space_fotter, null);
3.将其添加到您的列表视图中:
private ListView lv;
lv =(ListView)findViewById(android.R.id.list);
lv.addFooterView(SpaceFotter );
【讨论】: