上下元素的环绕列表视图

时间:2015-02-11 12:06:26

标签: android xml android-listview android-relativelayout

列表视图的高度应该是图片中的空白区域,而底部没有元素的高度。列表视图目前到达底部,但不应该。所以基本上列表视图应该由上部元素和下部元素包围。我怎样才能实现这个目标?

Rendered XML

XML目前如下:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TextView
    android:id="@+id/groupchat_tv_title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toLeftOf="@+id/groupchat_bt_edit"
    android:layout_alignParentLeft="true" />

<Button 
    android:id="@+id/groupchat_bt_edit"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:text="bearbeiten"
    android:onClick="editButtonOnClick" />

<ListView 
    android:id="@+id/groupchat_lv_conversation"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@+id/groupchat_bt_edit"
    android:background="#FFFFFF" />

<EditText 
    android:id="@+id/groupchat_et_message"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentBottom="true"
    android:layout_toLeftOf="@+id/groupchat_bt_send" />

<Button 
    android:id="@+id/groupchat_bt_send"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentBottom="true"
    android:text="senden"
    android:onClick="sendButtonOnClick" />

</RelativeLayout>

1 个答案:

答案 0 :(得分:1)

提到android:layout_above到ListView:

<ListView 
android:id="@+id/groupchat_lv_conversation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/groupchat_bt_edit"
android:layout_above="@+id/groupchat_et_message"
android:background="#FFFFFF" />