android slidingdrawer 方向,如何使Android SlidingDrawer从左侧滑出?

我找到了一个简单的方法来做到这一点。您所要做的就是为slidingDrawer,内容和句柄设置180º的旋转角度。

您可以类似地制作一个从顶部下降的SlidingDrawer,就像我做过here一样。

看看我的例子,首先从右到左,以便能够看到差异。

android:id="@+id/slidingDrawer"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:orientation="horizontal"

android:gravity="center_horizontal"

android:handle="@+id/handle"

android:content="@+id/content">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:src="@drawable/ic_launcher" />

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:background="#FF0000"

android:src="@drawable/ic_launcher" />

现在看看我改变了什么让它从左侧滑出。

android:id="@+id/slidingDrawer"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:orientation="horizontal"

android:gravity="center_horizontal"

android:handle="@+id/handle"

android:content="@+id/content"

android:rotation="180">

android:layout_width="wrap_content"

android:layout_height="wrap_content">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:src="@drawable/ic_launcher"

android:rotation="180" />

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:background="#FF0000"

android:src="@drawable/ic_launcher"

android:rotation="180" />

请注意,我也创建了一个LinearLayout来设置为句柄,并没有改变它的旋转,但我改变了它的子节点的旋转。这是为了防止我有一个小问题,但一切工作正常,很简单。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值