gpt4 book ai didi

android - ImageButton 的 RTL 支持,带有 autoMirror for src drawable

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:28:42 28 4
gpt4 key购买 nike

当使用 android:background="?android:attr/selectableItemBackground"android:src="@drawable/ic_action_send" 创建一个 ImageButton 时,添加 android:autoMirror="true" 没有任何明显的影响。有什么方法可以轻松支持 ImageButtons 上的从右到左 (RTL) 图像镜像?

最佳答案

制作一个 XML 可绘制对象并设置 android:autoMirrored="true"。在 API 19 之前该值被忽略。

res/drawable/icon_auto_mirrored.xml

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/icon"
android:autoMirrored="true"/>

现在在布局中使用 android:src="@drawable/icon_auto_mirrored

关于android - ImageButton 的 RTL 支持,带有 autoMirror for src drawable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35764461/

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