android 是否可以有多个SlidingDrawer
Android 中的很多东西都是新的,这里就是其中之一。
尝试使用 Android SlidingDrawer 小部件。
真的很想在屏幕右侧有 4 个。
当你把它们拉出来时,每一个都会填满屏幕。
我尝试在 R.layout.main
中创建其中 4 个,但只显示一个。
我在这里走错路了吗?
这是带有两个 SlidingDrawer 的 xml 文件
试图让两者都显示在右侧
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<SlidingDrawer android:id="@+id/SlidingDrawer2"
android:layout_width="wrap_content"
android:handle="@+id/slideHandleButton2"
android:content="@+id/contentLayout2"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/slideHandleButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:topOffset="10dip"
android:background="@drawable/icon">
</Button>
<RelativeLayout
android:layout_width="wrap_content"
android:id="@+id/contentLayout2"
android:orientation="horizontal"
android:gravity="center|top"
android:padding="10dip"
android:background="#C0C0C0"
android:layout_height="wrap_content">
<ImageView android:id="@+id/f"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Content"
android:src="@drawable/arrow_top_right">>
</ImageView>
</RelativeLayout>
</SlidingDrawer>
<SlidingDrawer android:id="@+id/SlidingDrawer"
android:layout_width="wrap_content"
android:handle="@+id/slideHandleButton"
android:content="@+id/contentLayout"
android:orientation="horizontal"
android:layout_weight="1"
android:layout_height="wrap_content"
>
<Button android:id="@+id/slideHandleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/icon"
android:topOffset="40dip">
</Button>
<RelativeLayout
android:layout_width="wrap_content"
android:id="@+id/contentLayout"
android:orientation="horizontal"
android:padding="10dip"
android:background="#C0C0C0"
android:layout_height="wrap_content">
<ImageView android:id="@+id/Button03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Content"
android:src="@drawable/arrow_top_right">
</ImageView>
</RelativeLayout>
</SlidingDrawer>
</LinearLayout>
Kind of new to many things in android and here is one.
Playing around with the Android SlidingDrawer widget.
Would really like to have 4 of them on the right side of the screen.
Each one filling the screen as you pull them out.
I try in my R.layout.main
to create 4 of them but only one show up.
Am i on the wrong path here?
here is xml file with two SlidingDrawer
trying to get both to show on the right side
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<SlidingDrawer android:id="@+id/SlidingDrawer2"
android:layout_width="wrap_content"
android:handle="@+id/slideHandleButton2"
android:content="@+id/contentLayout2"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/slideHandleButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:topOffset="10dip"
android:background="@drawable/icon">
</Button>
<RelativeLayout
android:layout_width="wrap_content"
android:id="@+id/contentLayout2"
android:orientation="horizontal"
android:gravity="center|top"
android:padding="10dip"
android:background="#C0C0C0"
android:layout_height="wrap_content">
<ImageView android:id="@+id/f"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Content"
android:src="@drawable/arrow_top_right">>
</ImageView>
</RelativeLayout>
</SlidingDrawer>
<SlidingDrawer android:id="@+id/SlidingDrawer"
android:layout_width="wrap_content"
android:handle="@+id/slideHandleButton"
android:content="@+id/contentLayout"
android:orientation="horizontal"
android:layout_weight="1"
android:layout_height="wrap_content"
>
<Button android:id="@+id/slideHandleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/icon"
android:topOffset="40dip">
</Button>
<RelativeLayout
android:layout_width="wrap_content"
android:id="@+id/contentLayout"
android:orientation="horizontal"
android:padding="10dip"
android:background="#C0C0C0"
android:layout_height="wrap_content">
<ImageView android:id="@+id/Button03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Content"
android:src="@drawable/arrow_top_right">
</ImageView>
</RelativeLayout>
</SlidingDrawer>
</LinearLayout>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这不仅仅是一个展示。我认为这两者是一个叠在另一个之上显示的。尝试偏移手柄,以便能够看到两个手柄。尝试将此具有不同偏移量的属性添加到两个滑动抽屉:
如果这不起作用,请尝试将其添加到两个滑动抽屉:
I don't think it is just one displayed. I think the two are displayed one on top of the other. Try offsetting the handles so you are able to see both the handles. Try adding this attribute with different offsets to both your slidingdrawers:
If that doesn't work, try adding this to both slidingdrawers: