【发布时间】:2012-02-20 14:37:57
【问题描述】:
我在使用 Android 中的 SlidingDrawer 时遇到了一些问题。我正在构建一个带有水平滑动抽屉的屏幕。它工作正常,按预期打开和关闭。我已将 bottomOffset 设置为 50dip,以便在抽屉关闭时查看 50dpi 的内容,但这并没有发生。
当抽屉关闭时,我看到屏幕右侧到手柄之间的距离为 50dip,但随后内容视图变得不可见,因此手柄和屏幕边缘之间有 50dip 的黑色空间,因为下图显示:
当我按下手柄按钮时,似乎内容的可见性变为可见,然后出现。我想保持内容可见而无需按下手柄,如下图所示:
我从http://blog.sephiroth.it/2011/03/29/widget-slidingdrawer-top-to-bottom/ 下载了SlidingDrawer 源代码,以便尝试更改代码并获得预期的结果,但我没有得到。
滑动抽屉的 XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<br.com.dina.partial.example.MultiDirectionSlidingDrawer
xmlns:my="http://schemas.android.com/apk/res/br.com.dina.partial.example"
android:id="@+id/map_slider"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
my:handle="@+id/Handle"
my:content="@+id/ViewLayout"
my:direction="rightToLeft"
my:bottomOffset="-65dip"
android:layout_below="@+id/test">
<Button android:id="@+id/Handle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="handle"/>
<LinearLayout android:id="@+id/ViewLayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.markupartist.android.widget.ActionBar
android:id="@+id/actionbar"
style="@style/ActionBar"/>
<FrameLayout android:id="@+id/ViewContent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white" />
</LinearLayout>
</br.com.dina.partial.example.MultiDirectionSlidingDrawer>
</RelativeLayout>
有没有办法实现我想要的?
非常感谢
编辑添加xml
【问题讨论】:
-
你能把 SlidingDrawer 的 XML 贴出来吗?
标签: android android-layout android-ui