2013-08-05 28 views
1

我在我的活动中有listview组件,并且我使用活动的布局xml文件设法在它下面添加按钮。但问题是,在风景中,按钮不可见,因为列表视图非常长。活动上的简单确定按钮

那么有没有办法添加简单的确定按钮来关闭当前的活动,但在横向或纵向模式下都可见?

我知道这个页面listview-voggela但它实现起来很复杂,我不是一个android专家。所以我正在寻找简单的解决方案。谢谢

+1

将您的按钮作为页脚添加到列表视图。或使用相对布局将您的按钮放在相对于按钮的底部,将您的列表视图放置在按钮上方。 – Raghunandan

回答

5
<?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> 
+0

好的,它的工作原理。我如何处理重叠? – Vlad

+0

嘿,它不会重叠...结帐... – Exceptional

+0

不知道你的位置,但我的按钮是半透明的,我看到它下面的列表查看项目。等待它必须全部工作。 – Vlad