简体   繁体   中英

What's wrong with this XML? SlidingDrawer / Layout

The Handle / Sliding drawer works, but the stuff to the 'left' of the screen doesn't appear. What am I doing incorrectly?

<?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"
    android:orientation="horizontal"
    >
    <LinearLayout
        android:layout_width="0dip"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:padding="20dp"
        android:background="#FFFFFF"
        android:layout_alignParentLeft="true"
        >
        <LinearLayout
            android:id="@+id/searchContainer"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="20dp"
            android:orientation="horizontal"
            android:background="#F1F1F1"
            >
            <EditText 
                android:id="@+id/searchbox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:hint="Search"
                />
            <CheckBox
                android:id="@+id/cbxEmployee"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Employee"
                />
            <CheckBox
                android:id="@+id/cbxInventory"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Inventory"
                />
        </LinearLayout>
        <Button
            android:id="@+id/btnSearchInventory"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Search Inventory"
            />
        <Button
            android:id="@+id/btnListInventory"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Manage Inventory"
            />
    </LinearLayout>
    <SlidingDrawer
            android:id="@+id/rightFrame"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="horizontal"
            android:handle="@+id/handle"
            android:content="@+id/content"
            >
            <Button 
                android:text="handle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/handle"
                />
            <LinearLayout 
                android:id="@+id/content"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical"
               android:background="#FFF"
            ></LinearLayout>
    </SlidingDrawer>

Your first LinearLayout width is 0dip!

 <LinearLayout
        android:layout_width="0dip"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:padding="20dp"
        android:background="#FFFFFF"
        android:layout_alignParentLeft="true"
        >

Also take into account that you are using RelativeLayout so the SlidingDrawer will be drawn over the LinearLayout. If your aim is to have the LinearLayout on the left and the SlidingDrawer on the right change the RelativeLayout for a LinearLayout

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