在Android的滑动抽屉布局问题抽屉、布局、问题、Android

2023-09-06 22:06:27 作者:龌龊掌门〃

您好,我已经把滑动抽屉在我的应用程序

hi i have put Sliding drawer in my application

但这需要空间,如以下图片,如果抽屉是打开

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

如果是收盘价,那么它看起来像

and if it is close then it looks like

我的布局如下

<?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

推荐答案

试着改变你的最外层布局到 RelativeLayout的。这应该允许滑动布局重叠它上面的LinearLayout膨胀时

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