gpt4 book ai didi

android - 左侧带箭头的微调器

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:56:31 24 4
gpt4 key购买 nike

我正在为 RTL 语言开发一个应用程序,想将箭头的位置更改为 Spinner 的左侧!有没有办法在不创建自定义微调器的情况下做到这一点?

最佳答案

您必须编写自定义微调器。示例代码如下。您可以根据需要进行编辑。

<Spinner
style="@style/spinner_style"
android:layout_width="match_parent"
android:layout_height="wrap content"
/>

@style/spinner_style:

 <style name="spinner_style">
<item name="android:background">@drawable/background_spinner</item>
</style>

@drawable/background_spinner

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item><layer-list>
<item><shape>
<solid android:color="@android:color/white" />
<corners android:radius="4dp" />
<padding android:left="8dp"/>
</shape></item>
<item><bitmap android:gravity="left"
android:src="@drawable/ic_arrow_drop_down_grey600_36dp"/>
</item>
</layer-list></item>
</selector>

关于android - 左侧带箭头的微调器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28715036/

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