你知道如何实现和winamp for android一样的效果吗?我想做类似的事情。那是当我点击listview时,滑动抽屉弹出。但到目前为止,我只能在不同的新活动中显示滑动抽屉。
如何在重叠视图中实现。那就是当我关闭抽屉时,布局显示在前面,并且滑动手柄在布局上,当我打开抽屉时,它覆盖了主要布局。
有什么想法吗?
谢谢 !!
你知道如何实现和winamp for android一样的效果吗?我想做类似的事情。那是当我点击listview时,滑动抽屉弹出。但到目前为止,我只能在不同的新活动中显示滑动抽屉。
如何在重叠视图中实现。那就是当我关闭抽屉时,布局显示在前面,并且滑动手柄在布局上,当我打开抽屉时,它覆盖了主要布局。
有什么想法吗?
谢谢 !!
步骤#1:创建一个RelativeLayout
第 2 步:将 UI 的其余部分放入RelativeLayout
第 3 步:将 放在SlidingDrawer
后面RelativeLayout
的子元素中,然后放入 UI 的其余部分(例如,在布局 XML 中,将其作为 的最后一个子元素RelativeLayout
)
RelativeLayout
( 和) 的子项FrameLayout
在 Z 轴上彼此堆叠(即,在屏幕表面之外)。因此,较晚的孩子将与较早的孩子重叠。通过放SlidingDrawer
最后一个,它会在打开时与其他所有内容重叠。
谢谢你帮助我的CommonsWare,我没有太多的声誉可以投票。这是我的示例布局...
我用作it.sephiroth.slider.widget.MultiDirectionSlidingDrawer
SlidingDrawer
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_marginLeft="82dp"
android:layout_alignTop="@+id/button_open">
<Button
android:id="@+id/button_open"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/open"
android:visibility="visible" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New EditText"
android:id="@+id/editText" android:layout_alignParentLeft="true" android:layout_marginLeft="114dp"
android:layout_alignParentTop="true" android:layout_marginTop="6dp"/>
</RelativeLayout>
<it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer
xmlns:panel="http://schemas.android.com/apk/res/it.sephiroth.demo.slider"
android:id="@+id/drawer"
panel:direction="topToBottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
panel:handle="@+id/handle"
panel:content="@+id/content">
<include
android:id="@id/content"
layout="@layout/pen_content" />
<ImageView
android:id="@id/handle"
android:layout_width="wrap_content"
android:layout_height="40px"
android:src="@drawable/sliding_drawer_handle_bottom" />
</it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer>
</RelativeLayout>