Sliding Drawer layout Problem in android

*爱你&永不变心* 提交于 2019-12-01 09:38:24

问题


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

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:


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



来源:https://stackoverflow.com/questions/6044094/sliding-drawer-layout-problem-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!