2015-01-06 2 views
0

У меня есть этот XML:Я не могу разместить относительный макет ниже списка друзей?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:tools="http://schemas.android.com/tools" 
       android:id="@+id/item_detail_container" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 

    <CheckBox 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="blocked" 
      android:id="@+id/isBlocked_cb" 
      android:layout_toStartOf="@+id/phone_editText" 
      android:layout_toLeftOf="@+id/phone_editText" 
      android:layout_above="@+id/comments_list" 
      android:checked="true" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true"/> 


    <AutoCompleteTextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/phone_editText" 
      android:hint="enter phone" 
      android:layout_alignParentTop="true" 
      android:layout_centerHorizontal="true"/> 

    <Button 
      style="?android:attr/buttonStyleSmall" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="search" 
      android:id="@+id/search_btn" 
      android:layout_toEndOf="@+id/phone_editText" 
      android:layout_toRightOf="@+id/phone_editText" 
      android:layout_above="@+id/comments_list" 
      android:layout_alignParentTop="true" android:layout_alignParentRight="true" 
      android:layout_alignParentEnd="true" android:onClick="foo"/> 

    <ListView 
      android:layout_width="match_parent" 
      android:layout_height="430dp" 
      android:id="@+id/comments_list" 
      android:layout_below="@+id/phone_editText"/> 

    <RelativeLayout android:id="@+id/bottom_container" 
        android:layout_width="match_parent" 
        android:layout_height="100dp" 
        android:layout_below="@id/item_list" 
        android:visibility="visible"> 
     <AutoCompleteTextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentBottom="true" 
       android:id="@+id/comment_text" 
       android:hint="enter comment"/> 

     <Button style="?android:attr/buttonStyleSmall" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Add" 
       android:id="@+id/add_btn" 
       android:layout_toRightOf="@+id/comment_text" 
       android:layout_alignTop="@+id/comment_text"/> 
    </RelativeLayout> 
    <LinearLayout 
      android:focusable="true" android:focusableInTouchMode="true" 
      android:layout_width="0px" android:layout_height="0px"/> 
</RelativeLayout> 

, но пока я не могу поместить list выше bottom container.

enter image description here

почему не могу я использовать wrap content для последней и по высоте?

ответ

0

вид списка неверный идентификатор comments_list, позволяет изменить его на item_list так, чтобы под ним находился bottom_container.

<ListView 
     android:layout_width="match_parent" 
     android:layout_height="430dp" 
     android:id="@+id/item_list" 
     android:layout_below="@+id/phone_editText"/> 

<RelativeLayout android:id="@+id/bottom_container" 
       android:layout_width="match_parent" 
       android:layout_height="100dp" 
       android:layout_below="@id/item_list" 
       android:visibility="visible"> 
Смежные вопросы