我想使用ConstraintLayout来实现阿拉伯语和英语的相同布局。当我使用LinearLayout时,ImageView和TextView会水平对齐,并根据语言更改布局方向。但是当我使用ConstraintLayout时,ImageView和TextView在阿拉伯语中不会从右到左对齐。
布局预览截图: 英文预览 阿拉伯文预览 期望的阿拉伯文输出 但是当我使用ConstraintLayout时,无法实现这一点。
布局预览截图: 英文预览 阿拉伯文预览 期望的阿拉伯文输出 但是当我使用ConstraintLayout时,无法实现这一点。
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rootView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:background="@color/white"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher_2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="@string/work_name"
app:layout_constraintBottom_toBottomOf="@+id/imageView"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toTopOf="@+id/imageView" />
</androidx.constraintlayout.widget.ConstraintLayout>