Cody
Cody

Reputation: 8964

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>

Upvotes: 0

Views: 293

Answers (1)

Chiara
Chiara

Reputation: 1887

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

Upvotes: 2

Related Questions