我已经找了很多地方,但是我找不到一个好的教程来指导我如何为我的应用程序制作一个SlidingDrawer。
假设我已经有了一个XML文件,我想在其中添加一个滑动抽屉。我还想添加一个文本视图和列表视图对象,以及it...how中的一些按钮。
任何帮助都将不胜感激!
发布于 2010-11-02 04:05:34
这是一个SlidingDrawer sample app。具体来说,这里是布局:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FF4444CC"
>
<SlidingDrawer
android:id="@+id/drawer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:handle="@+id/handle"
android:content="@+id/content">
<ImageView
android:id="@id/handle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/tray_handle_normal"
/>
<Button
android:id="@id/content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="I'm in here!"
/>
</SlidingDrawer>
</FrameLayout>现在,在本例中,整个活动只是一个SlidingDrawer。这是相对不寻常的--这个样本很短,因为它来自一本书。
更常见的情况是,我希望您将SlidingDrawer作为RelativeLayout的子项,这样您就可以拥有RelativeLayout的其他子项,并在打开时让抽屉滑到它们上面。我相信在这种情况下,您需要将SlidingDrawer作为RelativeLayout的最后一个子级。
https://stackoverflow.com/questions/4072057
复制相似问题