简体   繁体   中英

problem placing Button/ListView under relative layout in layout XML

The following is the layout XML for something I am working on. It is supposed to display and edit field and some buttons at the top of the display with a ListView filling up the rest. However only the items embedded in the RelativeLayout show up. The items below do not display. I'm not sure what I am doing wrong in the layout XML.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
<RelativeLayout
    android:orientation="vertical" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:padding="10px">

    <TextView android:id="@+id/tidName" 
              android:layout_width="wrap_content" 
              android:layout_height="wrap_content" 
              android:gravity="center_horizontal"
              android:text="Enter Name:" />

    <EditText android:id="@+id/eidName" 
              android:layout_width="fill_parent" 
              android:layout_height="wrap_content" 
              android:background="@android:drawable/editbox_background"
              android:layout_below="@id/tidName" />

    <Button android:id="@+id/bidShow" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_below="@id/tidName"
            android:layout_alignParentRight="true"
            android:layout_marginLeft="10px"
            android:text="Show Search Results" />

    <Button android:id="@+id/bidUseDefault"
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content"
            android:layout_below="@id/tidName"
            android:layout_alignParentLeft="true"
            android:layout_marginRight="10px"
            android:text="Use Default" />

</RelativeLayout>
<Button 
            android:layout_below="@id/ridMain"
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="Refresh" />
<ListView android:id="@+id/lidResults"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
</LinearLayout>

thanks in advance,

Add android:orientation="vertical" on your main layout

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM