Reputation: 1655
I want to have a sliding drawer which shows up at the bottom of my view but it currently does not show. I have also tried using a linear layout as the root with the scroll view have a weight of 1 but that caused the scroll view and its contents to not show. Any ideas?
My View:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ScrollView
android:id="@+id/scrollLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".AddScheduleItemActivity" >
.
.
.
</LinearLayout>
</ScrollView>
<SlidingDrawer
android:id="@+id/slidingDrawer1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/scrollLayout"
android:content="@+id/content"
android:handle="@+id/handle" >
<Button
android:id="@+id/handle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Handle" />
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/hadsfndle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="sdf" />
</LinearLayout>
</SlidingDrawer>
Thanks, Nathan
In the picture I want the blue to be the scroll view and contents and the green to be the handle for the slider.
Tried following some other suggestions and came to this which still doesn't work. The contents of the scrollview show fine but the slider is not shown. Need some more suggestions! Thanks!
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:gravity="bottom"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
.
.
.
</RelativeLayout>
</ScrollView>
<SlidingDrawer
android:id="@+id/slidingDrawer1"
android:layout_width="match_parent"
android:layout_height="50dip"
android:layout_alignParentBottom="true"
android:layout_below="@+id/scrollLayout"
android:content="@+id/content"
android:handle="@+id/handle"
android:orientation="vertical" >
<Button
android:id="@+id/handle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Handle" />
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/hadsfndle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="sdf" />
</LinearLayout>
</SlidingDrawer>
</RelativeLayout>
Well it appears that sliding drawer is no longer supported so I guess I will look for an alternative :(
Upvotes: 0
Views: 1327
Reputation: 739
Perhaps your question had already been answer here.
Try this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ScrollView
android:id="@+id/scrollLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
.
.
.
</RelativeLayout>
</ScrollView>
<SlidingDrawer
android:id="@+id/slidingDrawer1"
android:layout_width="match_parent"
android:layout_height="50dip"
android:layout_alignParentBottom="true"
android:content="@+id/content"
android:handle="@+id/handle"
android:orientation="vertical" >
<Button
android:id="@+id/handle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Handle" />
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/hadsfndle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="sdf" />
</LinearLayout>
</SlidingDrawer>
</RelativeLayout>
Upvotes: 0
Reputation: 10969
You are trying to show your sliderdrawar at bottom, try below code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ScrollView
android:id="@+id/scrollLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="@+id/layout"
android:orientation="vertical" >
<SlidingDrawer
android:id="@+id/SlidingDrawer"
android:layout_width="wrap_content"
android:layout_height="250dip"
android:content="@+id/contentLayout"
android:handle="@+id/slideHandleButton"
android:padding="10dip" >
<Button
android:id="@+id/slideHandleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher" >
</Button>
<LinearLayout
android:id="@+id/contentLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#C0C0C0"
android:gravity="center|top"
android:orientation="vertical"
android:padding="10dip" >
<Button
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Content" >
</Button>
<Button
android:id="@+id/Button02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Content" >
</Button>
<Button
android:id="@+id/Button03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Content" >
</Button>
</LinearLayout>
</SlidingDrawer>
</LinearLayout>
</RelativeLayout>
If above code is not solve your issue then change parent layout to LinearLayout
give weightsum=10
and then distribute among your scrollview & sliderDrawer
to equal.
Upvotes: 1
Reputation: 3261
Try this,
Add layout_alignParentBottom
on your SlidingDrawer
.
android:layout_alignParentBottom="true"
Upvotes: 0