在Android的滑动抽屉布局问题 [英] Sliding Drawer layout Problem in android

查看:172
本文介绍了在Android的滑动抽屉布局问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

这篇关于在Android的滑动抽屉布局问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆