首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安卓SlidingDrawer操作指南

安卓SlidingDrawer操作指南
EN

Stack Overflow用户
提问于 2010-11-02 02:49:16
回答 1查看 3.6K关注 0票数 2

我已经找了很多地方,但是我找不到一个好的教程来指导我如何为我的应用程序制作一个SlidingDrawer。

假设我已经有了一个XML文件,我想在其中添加一个滑动抽屉。我还想添加一个文本视图和列表视图对象,以及it...how中的一些按钮。

任何帮助都将不胜感激!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-11-02 04:05:34

这是一个SlidingDrawer sample app。具体来说,这里是布局:

代码语言:javascript
复制
<?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的最后一个子级。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4072057

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档