【问题标题】:Surround list view by upper and lower elements通过上下元素环绕列表视图
【发布时间】:2015-02-11 12:06:26
【问题描述】:

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

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>

【问题讨论】:

    标签: android xml android-listview android-relativelayout


    【解决方案1】:

    在 ListView 中提及 android:layout_above:

    <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" />
    

    【讨论】:

      猜你喜欢
      • 2016-02-21
      • 2014-01-12
      • 1970-01-01
      • 2021-12-23
      • 2023-03-23
      • 2021-10-09
      • 2014-08-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多