我SlidingDrawer
在我的应用程序中使用过。现在我想在其中添加滚动视图。我试过这样做,但它给了我一个错误,说滑动抽屉必须有指定的尺寸。
任何人都可以帮助我。
问问题
2265 次
2 回答
1
您需要像 Yann MASOCH 所说的那样设置 layout_width 和 layout_height 以消除该错误消息。
还要记住在滚动视图中将 id 设置为 id/content 而不是线性布局,以便滑动抽屉与滚动一起使用。这是一个带有滚动条的 SlidingDrawer 示例:
<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>
于 2012-11-19T04:20:06.987 回答
1
对于滚动视图,您必须至少键入:
<ScrollView
android:layout_width="fill_parent or wrap_content or your value"
android:layout_height="fill_parent or wrap_content or your value" >
</ScrollView>
于 2011-08-30T14:17:34.133 回答