android中从左到右的slidedrawer

时间:2012-07-12 11:17:01

标签: android

任何人都可以给出一个简单的例子,说明如何在Android中从左到右制作一个slidedrawer 我非常搜索互联网,但无法得到适当的解决方案。 等待你的回复。 谢谢你:))

1 个答案:

答案 0 :(得分:0)

水平滑动抽屉请使用下面的代码。

main.xml中

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <ImageView 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:src="@drawable/icon"/>

    <SlidingDrawer
        android:id="@+id/drawer"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="horizontal"
        android:handle="@+id/handle"
        android:content="@+id/content">
        <ImageView 
            android:id="@id/handle"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent" 
            android:src="@drawable/icon"/>
        <LinearLayout
            android:id="@id/content"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical"
            android:padding="10dp"
            android:background="#55000000">
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" 
                android:text=" - Button - "/>
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" 
                android:text=" - Button - "/>
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" 
                android:text=" - Button - "/>
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" 
                android:text=" - Button - "/>
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" 
                android:text=" - Button - "/>
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" 
                android:text=" - Button - "/>
        </LinearLayout>
    </SlidingDrawer>
</FrameLayout>

使用以下示例链接进行参考。

SlidingDrawer in horizontal - 1

SlidingDrawer in horizontal - 2