android - android:autoMirrored 不适用于矢量可绘制对象
问题描述
当我的设备上设置了 RTL 语言时,为什么我的矢量可绘制对象拒绝镜像自身?我已经检查了为 RTL 布局启用自动镜像框,但由于某种原因这不起作用。
当前结果(英文)
预期结果(希伯来语)
当前结果(希伯来语)
可绘制的 XML
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:autoMirrored="true"
android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,4l-1.41,1.41L16.17,11H4v2h12.17l-5.58,5.59L12,20l8,-8z"/>
</vector>
活动布局
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val mTV = findViewById<TextView>(R.id.myTV)
val appName = getString(R.string.app_name)
val template = "$appName <img src=\"arrow\"/> $appName"
mTV.text = Html.fromHtml(template, Html.FROM_HTML_MODE_COMPACT, imageGetter, null)
}
private val imageGetter = Html.ImageGetter { name ->
val resId = if (name == "arrow") R.drawable.ic_arrow
else throw IllegalArgumentException("what the heck is $name")
ResourcesCompat.getDrawable(resources, resId, theme)?.apply {
setBounds(0, 0, intrinsicWidth, intrinsicHeight)
}
}
}
解决方案
推荐阅读
- css - 使用 Bootstrap 4.4、Wordpress 和 Bootstrap Shortcodes Ultimate 插件的 Flexbox 列等高
- javascript - Fullpage.js 将手动滚动到最近的部分
- javascript - 如何导入 vue js 组件?
- javascript - 如何比较两个不同的 Firestore 查询?
- mysql - MySQL,在存储过程中使用 CONCAT 的问题
- docker - DockerOperator 气流中的 Execution_date
- python - 我必须从给定的 Dataframe 中获取“True”值多于“False”值的组:
- python - 如何使用 Pandas 的条件删除数据框中的某些行?
- search - Crystal Reports 选择公式 Crystal 语法 - 以数字或斜线/或破折号搜索日期 - 在 DDMMYYYY 之间
- docker - 无法构建 docker 文件 c# - Visual Studio 2019