0

I would like to define the height of sliding drawer height dynamically or statically whatever. Below is my xml layout file. Any suggestion would be appreciate.

<?xml version="1.0" encoding="utf-8"?>

    <SlidingDrawer android:layout_width="fill_parent"
        android:id="@+id/SlidingDrawer" android:handle="@+id/slideHandleButton"
        android:content="@+id/contentLayout" android:layout_height="wrap_content">
        <ImageView android:layout_width="fill_parent"
            android:layout_height="wrap_content" android:id="@+id/slideHandleButton"
            android:background="@drawable/icon_movie"></ImageView>
        <LinearLayout android:layout_width="fill_parent"
            android:id="@+id/contentLayout" android:gravity="center"
            android:background="#C0C0C0" android:layout_height="wrap_content">
            <Gallery android:id="@+id/gallery" android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        </LinearLayout>
    </SlidingDrawer>
</FrameLayout>

geekmyo
  • 179
  • 4
  • 19
  • possible duplicate of [Android: can height of SlidingDrawer be set with wrap_content?](http://stackoverflow.com/questions/3654492/android-can-height-of-slidingdrawer-be-set-with-wrap-content) – Matthew Mar 18 '11 at 17:07

3 Answers3

2

You can set the height to a specific height such as 200dp, or you can use something like this workaround if you want to use wrap_content.

Community
  • 1
  • 1
Matthew
  • 44,826
  • 10
  • 98
  • 87
  • hey matt, i tried already with set height to 200 dp but it doesn't working as well, slider just move to the center of screen when i set layout_height attribute to 200 dp. Any ideas ? – geekmyo Mar 18 '11 at 17:23
  • You mean, it's no longer attached to the bottom of the screen? It could be that your FrameLayout has not set its layout_height to fill_parent, and also you may have to set android:layout_gravity="bottom" on your SlidingDrawer – Matthew Mar 18 '11 at 18:48
1

Use topOffset attribute for SlidingDrawer.

like this...

<SlidingDrawer 
...
android:topOffset="800px"
pretty angela
  • 2,241
  • 1
  • 19
  • 8
1

just set to pmargin in sliding drawer in your xml

android:layout_marginTop="50dip"
A B
  • 221
  • 3
  • 9