parser_failed
parser_failed

Reputation: 697

Android : is there a way to properly set a SlidingDrawer width and height to half screen?

I have to set a SlidingDrawer on the right side and on click it should not expand over the half screen. I saw many tutos and i managed to set it more or less correctly but it's currently pushing everything in the layout to the left. Here is my xml:

<LinearLayout android:layout_height="wrap_content"
    android:id="@+id/edition_content_linear" android:layout_width="fill_parent"
    android:layout_weight="1" android:background="@android:color/white">

    <LinearLayout android:layout_width="fill_parent"
        android:id="@+id/static_menu_layout" android:layout_height="fill_parent"
        android:layout_weight="2" android:visibility="gone" android:background="@drawable/ipad_category_back">

        <ExpandableListView android:id="@+id/static_expandable_list"
            android:layout_height="fill_parent" android:layout_width="fill_parent"
            android:drawSelectorOnTop="false" android:groupIndicator="@drawable/expandablelist_selector" android:indicatorLeft="210dp" android:indicatorRight="230dp"></ExpandableListView>

    </LinearLayout>

    <LinearLayout android:id="@+id/center_linear"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:layout_weight="1">

        <ImageView android:scaleType="centerInside"
            android:layout_height="fill_parent" android:layout_width="fill_parent"
            android:id="@+id/cover_image_big"></ImageView>

        <WebView android:id="@+id/story_webview"
            android:layout_height="fill_parent" android:layout_width="fill_parent"
            android:visibility="gone"></WebView>

    </LinearLayout>

    <SlidingDrawer android:id="@+id/slider_drawer"
    android:layout_width="250dp" android:layout_height="500dp"
    android:orientation="horizontal" android:layout_gravity="center_vertical"
    android:handle="@+id/slider_handle" android:content="@+id/slider_expandable_list_container">

    <ImageView android:id="@+id/slider_handle"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:src="@drawable/menu_handler" />

    <RelativeLayout android:id="@+id/slider_expandable_list_container"
        android:layout_height="500dp" android:layout_width="250dp">
        <ExpandableListView android:id="@+id/slider_expandable_list"
            android:layout_height="fill_parent" android:layout_width="fill_parent"
            android:drawSelectorOnTop="false" android:indicatorLeft="210dp" android:layout_gravity="center_vertical"
            android:indicatorRight="230dp" android:groupIndicator="@drawable/expandablelist_selector"></ExpandableListView>

    </RelativeLayout>

   </SlidingDrawer>

</LinearLayout>

Upvotes: 3

Views: 3563

Answers (1)

Kantesh
Kantesh

Reputation: 875

Its always better to put the sliding drawer in a frame layout. Because in Framelayout, views will be drawn one on the other. Then even even you drawer opens up it 'll be overlapped on the views beneath. But note that in Framelayout drawer expands up to all the framelayout length. If you want to limit the length of expansion of the drawer, then give a length to your parent framelayout.

Upvotes: 4

Related Questions