android是否可以有多个SlidingDrawer

标签 android slidingdrawer

android 中的许多东西都是新的,这里就是一个。

尝试使用 Android SlidingDrawer 小部件。
真的很想在屏幕右侧有 4 个。
当您将它们拉出时,每一个都会填满屏幕。

我尝试在我的 R.layout.main 中创建 4 个,但只显示一个。

我走错路了吗?

这是带有两个 SlidingDrawer 的 xml 文件
试图让两者都显示在右侧

<LinearLayout android:id="@+id/LinearLayout01"
              android:layout_width="fill_parent" 
              android:layout_height="wrap_content"
              xmlns:android="http://schemas.android.com/apk/res/android"
              >

 <SlidingDrawer android:id="@+id/SlidingDrawer2" 
        android:layout_width="wrap_content" 
        android:handle="@+id/slideHandleButton2" 
        android:content="@+id/contentLayout2" 
        android:layout_weight="1"
        android:layout_height="wrap_content" 
        android:orientation="horizontal">

        <Button android:id="@+id/slideHandleButton2"
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:topOffset="10dip"
            android:background="@drawable/icon">
        </Button>

        <RelativeLayout 
            android:layout_width="wrap_content" 
            android:id="@+id/contentLayout2" 
            android:orientation="horizontal" 
            android:gravity="center|top" 
            android:padding="10dip" 
            android:background="#C0C0C0" 
            android:layout_height="wrap_content">

       <ImageView android:id="@+id/f" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="Content"
            android:src="@drawable/arrow_top_right">>
        </ImageView>

    </RelativeLayout>
 </SlidingDrawer>


 <SlidingDrawer android:id="@+id/SlidingDrawer" 
        android:layout_width="wrap_content" 
        android:handle="@+id/slideHandleButton" 
        android:content="@+id/contentLayout" 
        android:orientation="horizontal"
        android:layout_weight="1"
        android:layout_height="wrap_content" 
        >

        <Button android:id="@+id/slideHandleButton"
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:background="@drawable/icon"
            android:topOffset="40dip">
        </Button>

        <RelativeLayout 
            android:layout_width="wrap_content" 
            android:id="@+id/contentLayout" 
            android:orientation="horizontal" 
            android:padding="10dip" 
            android:background="#C0C0C0" 
            android:layout_height="wrap_content">

         <ImageView android:id="@+id/Button03" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="Content"
            android:src="@drawable/arrow_top_right">
        </ImageView>
    </RelativeLayout>
 </SlidingDrawer>
</LinearLayout>

最佳答案

我不认为它只是一个显示。我认为这两个显示在另一个之上。尝试偏移 handle ,以便您能够看到两个 handle 。尝试将具有不同偏移量的此属性添加到您的两个滑动抽屉中:

android:topOffset="10dip"

如果这不起作用,请尝试将其添加到两个滑动抽屉中:

android:layout_weight="1"
android:layout_height="0"

关于android是否可以有多个SlidingDrawer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6404606/

相关文章:

java - 让我的 Android 应用程序在按下按钮后启动通话功能

android - 在保持焦点的同时禁用 EditText 输入

java - 从底部滑动菜单,就像在 Dropbox 中一样

android - 滑动抽屉隐藏ListView

Android 存储库模式

java - 谷歌地图 v2 出错

android - 使用 SimonVT 的 android-menudrawer 将滑动菜单添加到 Activity 中

android - 我如何在 Android API 级别 10 上实现带有 ListView 的 SlidingDrawer?

java - Android 如何处理 Android 中的背景图像?