4

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>
Erik
  • 5,039
  • 10
  • 63
  • 119
  • could you please post your layout file so it is easier to understand your problem? – Srichand Yella Jun 19 '11 at 19:40
  • 2
    I like this idea. However, I'm not sure how much success you'll have doing it like that. If you can't get the SlidingDrawers to work, you may consider manually placing some tab-looking images on the right of the screen and using a ViewFlipper with the push_left_in animation to make them slide in. That's my $0.02. – Glendon Trullinger Jun 19 '11 at 19:57
  • @Glendon Trullinger Thanks interesting.. Will try the ViewFlipper approach – Erik Jun 19 '11 at 19:58

1 Answers1

4

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"
Srichand Yella
  • 4,218
  • 2
  • 23
  • 24
  • i put the topOffset in the slideHandleButton but no change. the android:layout_weight="1" did something. i see one handler in the center middle of the screen now. the other is right center. kind of funny – Erik Jun 19 '11 at 20:11
  • but its working, just need to adjust the xml for 4 handler, thanks @Srichand – Erik Jun 19 '11 at 20:18
  • i think i could in the onCreate calculate the screen h/w to get y-position for all SlidingDrawer. what you think? – Erik Jun 19 '11 at 20:25
  • that wouldn't be necessary.. when you set the weight to 1 and height to 0, it automatically shares the screen among all the slidingdrawers equally – Srichand Yella Jun 19 '11 at 20:30
  • when i put android:layout_height="0px" the SD is not visible anymore. – Erik Jun 19 '11 at 20:37
  • i update my question with current XML. That show two handler center middle and center right – Erik Jun 19 '11 at 20:57