Android是有可能有多个SlidingDrawer [英] android Is it possible to have multiple SlidingDrawer

查看:117
本文介绍了Android是有可能有多个SlidingDrawer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的一种新的对Android的很多事情,这里是其中之一。

随着Android SlidingDrawer部件混。结果
真的想对他们有4在屏幕的右侧。结果
每一个填充屏幕,你拉出来。

我试着在我的 R.layout.main 以创建其中的4个,但只有一个显示出来。

我在这里走错路了?

下面是一个有两个SlidingDrawer结果xml文件
试图获得既显示在右侧

 <的LinearLayout机器人:ID =@ + ID / LinearLayout01
              机器人:layout_width =FILL_PARENT
              机器人:layout_height =WRAP_CONTENT
              的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
              > < SlidingDrawer机器人:ID =@ + ID / SlidingDrawer2
        机器人:layout_width =WRAP_CONTENT
        机器人:手柄=@ + ID / slideHandleButton2
        机器人:CONTENT =@ + ID / contentLayout2
        机器人:layout_weight =1
        机器人:layout_height =WRAP_CONTENT
        机器人:方向=横向>        <按钮机器人:ID =@ + ID / slideHandleButton2
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:topOffset =10dip
            机器人:背景=@绘制/图标>
        < /按钮>        < RelativeLayout的
            机器人:layout_width =WRAP_CONTENT
            机器人:ID =@ + ID / contentLayout2
            机器人:方向=横向
            机器人:比重=中心|顶
            机器人:填充=10dip
            机器人:背景=#C0C0C0
            机器人:layout_height =WRAP_CONTENT>       < ImageView的机器人:ID =@ + ID / F
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:文字=内容
            机器人:SRC =@绘制/ arrow_top_right>>
        < / ImageView的>    < / RelativeLayout的>
 < / SlidingDrawer>
 < SlidingDrawer机器人:ID =@ + ID / SlidingDrawer
        机器人:layout_width =WRAP_CONTENT
        机器人:手柄=@ + ID / slideHandleButton
        机器人:CONTENT =@ + ID / contentLayout
        机器人:方向=横向
        机器人:layout_weight =1
        机器人:layout_height =WRAP_CONTENT
        >        <按钮机器人:ID =@ + ID / slideHandleButton
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:背景=@绘制/图标
            机器人:topOffset =40dip>
        < /按钮>        < RelativeLayout的
            机器人:layout_width =WRAP_CONTENT
            机器人:ID =@ + ID / contentLayout
            机器人:方向=横向
            机器人:填充=10dip
            机器人:背景=#C0C0C0
            机器人:layout_height =WRAP_CONTENT>         < ImageView的机器人:ID =@ + ID / Button03
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:文字=内容
            机器人:SRC =@绘制/ arrow_top_right>
        < / ImageView的>
    < / RelativeLayout的>
 < / SlidingDrawer>
< / LinearLayout中>


解决方案

我不认为这只是一个显示。我认为两者都显示一个在另一个的顶部。尝试抵消手柄,所以你能够看到这两个把手。尝试加入不同的偏移量的属性到这两个slidingdrawers:

 的android:topOffset =10dip

如果还是不行,请尝试将这种既slidingdrawers:

 的android:layout_weight =1
机器人:layout_height =0

Kind of new to many things in android and here is one.

Playing around with the Android SlidingDrawer widget.
Would really like to have 4 of them on the right side of the screen.
Each one filling the screen as you pull them out.

I try in my R.layout.main to create 4 of them but only one show up.

Am i on the wrong path here?

here is xml file with two SlidingDrawer
trying to get both to show on the right side

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

解决方案

I don't think it is just one displayed. I think the two are displayed one on top of the other. Try offsetting the handles so you are able to see both the handles. Try adding this attribute with different offsets to both your slidingdrawers:

android:topOffset="10dip"

If that doesn't work, try adding this to both slidingdrawers:

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

这篇关于Android是有可能有多个SlidingDrawer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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