Sliding Drawer layout Problem in android

2019-02-19 13:04发布

hi i have put Sliding drawer in my application

but this takes Space like in below Image if drawer is open

enter image description here

and if it is close then it looks like

enter image description here

enter image description here

My layout is below

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:gravity="bottom" android:background="@drawable/androidpeople">
    <LinearLayout
    android:layout_width="fill_parent" android:layout_height="wrap_content"
    android:orientation="vertical">
    <Button android:id="@+id/Button01" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="Content">
        </Button>
        <Button android:id="@+id/Button02"
             android:layout_width="wrap_content" 
             android:layout_height="wrap_content" 
             android:text="Content">
         </Button>
        <Button android:id="@+id/Button03" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="Content">
        </Button>
        <Button android:id="@+id/Button01" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="Content">
        </Button>
        <Button android:id="@+id/Button02"
             android:layout_width="wrap_content" 
             android:layout_height="wrap_content" 
             android:text="Content">
         </Button>
        <Button android:id="@+id/Button03" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="Content">
        </Button>

    </LinearLayout>
    <SlidingDrawer 
        android:layout_width="wrap_content" 
        android:id="@+id/SlidingDrawer" 
        android:handle="@+id/slideHandleButton" 
        android:content="@+id/contentLayout" 
        android:padding="10dip" 
        android:layout_height="250dip">
        <Button android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:id="@+id/slideHandleButton" 
            android:background="@drawable/closearrow">
        </Button>
        <LinearLayout android:layout_width="wrap_content" 
            android:id="@+id/contentLayout" 
            android:orientation="vertical" 
            android:gravity="center|top" 
            android:padding="10dip" 
            android:background="#C0C0C0" 
            android:layout_height="wrap_content">


        <Button android:id="@+id/Button01" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="Content">
        </Button>
        <Button android:id="@+id/Button02"
             android:layout_width="wrap_content" 
             android:layout_height="wrap_content" 
             android:text="Content">
         </Button>
        <Button android:id="@+id/Button03" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="Content">
        </Button>
</LinearLayout>
    </SlidingDrawer>
</LinearLayout>

My problem is even drawer is closed it takes space and i want to remove it so that first button top of the screen can come down

1条回答
倾城 Initia
2楼-- · 2019-02-19 13:44

try changing your outermost layout to a relativelayout. this should allow the sliding layout to overlap the linearlayout above it when it expands.

查看更多
登录 后发表回答