gpt4 book ai didi

android - 如何更改android slidingdrawer handle 按钮位置

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:20:10 24 4
gpt4 key购买 nike

在抽屉中央的android SlidingDrawer中默认的 handle 按钮。是否可以将该位置更改为向左或向右..?如果可能的话,我该怎么做,android:gravity="left" 在按钮中不起作用。

最佳答案

将你的句柄放在 RelativeLayout 中,并在句柄上设置 android:layout_alignParentRight="true"。

例如像这样:

<?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="wrap_content">

<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />

<SlidingDrawer android:id="@+id/drawer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:handle="@+id/handle"
android:content="@+id/content">

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/handle">
<ImageView android:src="@drawable/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
</RelativeLayout>

<LinearLayout
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#aaaa00" android:id="@+id/content">
<ImageView android:src="@drawable/icon"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center">
</ImageView>
</LinearLayout>

</SlidingDrawer>

</FrameLayout>

关于android - 如何更改android slidingdrawer handle 按钮位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6894149/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com