I have a layout, which supports RTL. It looks fine in preview in Android studio and on device in default locale, but is broken in Arabic locale. There is an image on start, button on end and two texts in between.

Here's how it is designed and looks like in preview: d1324e00a54a4677211d102bd1c4a673.png

For some reason both button and image are placed at the end in Arabic locale. So, texts have no room and are not displayed, but view height is much larger than expected.

c1732afa4d0d420680e5ec28c3777b5f.png

Here's how it looks like in LayoutInspector

a62f19c4b014c504661a6c554ff010ff.png

What can be wrong with it? I use databinding, if it does matter. This layout is placed in separate file and included with include tag

Here's the layout:

android:layout_width="match_parent" android:layout_height="match_parent"

android:padding="@dimen/spacing_med"

>

android:id="@+id/avatar"

android:layout_width="32dp"

android:layout_height="32dp"

tools:layout_constraintStart_toStartOf="parent"

tools:layout_constraintTop_toTopOf="parent"

/>

android:id="@+id/call"

android:text="@string/call"

android:drawableStart="@drawable/ic_phone_pink"

android:paddingLeft="@dimen/spacing_med"

android:paddingRight="@dimen/spacing_med"

app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintTop_toTopOf="parent"

android:minWidth="70dp"

/>

android:id="@+id/name"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_marginStart="@dimen/spacing_med"

android:layout_marginEnd="@dimen/spacing_med"

app:layout_constraintTop_toTopOf="parent"

app:layout_constraintEnd_toStartOf="@id/call"

app:layout_constraintStart_toEndOf="@id/avatar"

/>

android:id="@+id/phone"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_marginStart="@dimen/spacing_med"

android:layout_marginEnd="@dimen/spacing_med"

app:layout_constraintTop_toBottomOf="@id/name"

app:layout_constraintEnd_toStartOf="@id/call"

app:layout_constraintStart_toEndOf="@id/avatar"

/>

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐