Add scroll view in sliding Drawer
I have used SlidingDrawer
in my application. Now I want to add scroll view in it. I have tried 开发者_如何转开发to do so but it gives me error which says sliding drawer must have specified dimensions.
For a scrollview, you must type at the least :
<ScrollView
android:layout_width="fill_parent or wrap_content or your value"
android:layout_height="fill_parent or wrap_content or your value" >
</ScrollView>
You need to set layout_width and layout_height as Yann MASOCH says to get rid of that error message.
Also remember to set the id as id/content in the scrollview instead of the linearLayout in order for the slidingdrawer to work with scroll. Here is an example of the SlidingDrawer with scroll:
<SlidingDrawer
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:handle="@+id/handle"
android:content="@+id/content">
<Button
android:id="@id/handle"
android:layout_width="88dip"
android:layout_height="44dip"
android:background="@drawable/btn_blue"
android:text="help"
android:textColor="#ffffff"/>
<ScrollView
android:id="@id/content"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
(other TextViews etc)
</LinearLayout>
</ScrollView>
</SlidingDrawer>
精彩评论