如何解决当新句子以数字开头时,RTL文本不是从右开始
我有以下XML-
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/group_task_root_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/list_selector_background"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/group_task_image"
android:layout_gravity="center"
android:src="@drawable/logo" />
<ImageView
android:id="@+id/group_task_done_indicator"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginStart="14dp"
android:src="@drawable/done"
android:visibility="gone"
tools:visibility="visible" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="14dp"
android:layout_marginEnd="4dp"
android:orientation="vertical">
<TextView
android:id="@+id/group_task_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textDirection="locale"
android:textAlignment="gravity"
android:textSize="18sp"
tools:text="Task's very long title" />
</LinearLayout>
</LinearLayout>
</layout>
对于这种特定的XML,我需要同时支持RTL和LTR。
我面临的问题是这样的-
如您所见,我有很好的RTL文本,但是如果我换行到新行并只写数字而不跟随RTL文本,它将显示在LTR。
对此有适当的解决方法吗?
解决方法
您应该将android:gravity="right"
添加到TextView
我希望为您工作:)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。