我的 Activity 中有 ListView 组件,我设法使用 Activity 的布局 xml 文件在其下方添加按钮。但问题是,在横向模式下,按钮不可见,因为 ListView 很长。
那么有没有办法添加简单的 OK 按钮来关闭当前 Activity ,但在横向或纵向模式下都可见?
我知道这个页面listview-voggela但是实现起来有点复杂,而且我不是安卓专家。所以我正在寻找简单的解决方案。谢谢
最佳答案
<?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:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/okbutton"
android:text="@string/hello" android:layout_alignParentBottom="true" />
<ListView android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/list"
android:layout_alignParentTop="true" android:layout_above="@id/okbutton" />
</RelativeLayout>
关于android - Activity 上的简单确定按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18057312/