Reputation: 2489
We've encountered a problem creating activities with RTL languages (Hebrew)
Every time we create such constraint layout, the activity on the emulator looks exactly opposite to the one in the editor (mirror)
Furthermore, the Hebrew text disappears.
e.g.
editor:
And the XML code(start and end snippet)
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.rubz.dvir.rubz.jobsummery">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</android.support.design.widget.AppBarLayout>
<ImageView
android:id="@+id/top_bar"
android:layout_width="375dp"
android:layout_height="70dp"
android:scaleType="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/top_bar" />
<ImageButton
android:id="@+id/menu_icon"
android:layout_width="20dp"
android:layout_height="14dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="24dp"
app:layout_constraintBottom_toBottomOf="@+id/top_bar"
app:layout_constraintEnd_toEndOf="@+id/top_bar"
app:layout_constraintTop_toBottomOf="@+id/appBarLayout"
app:layout_constraintVertical_bias="0.617"
app:srcCompat="@drawable/menu_icon" />
<ImageView
android:id="@+id/pop_up"
android:layout_width="0dp"
android:layout_height="452dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/top_bar"
app:layout_constraintVertical_bias="1.0"
app:srcCompat="@drawable/pop_up" />
<TextView
android:id="@+id/statistics"
android:layout_width="107dp"
android:layout_height="16dp"
android:layout_marginBottom="10dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:gravity="center_horizontal"
android:letterSpacing="0.08"
android:lineSpacingExtra="32.3sp"
android:textColor="#22303f"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/pop_up"
app:layout_constraintEnd_toEndOf="@+id/pop_up"
app:layout_constraintHorizontal_bias="0.817"
app:layout_constraintStart_toStartOf="@+id/pop_up"
app:layout_constraintTop_toTopOf="@+id/pop_up"
app:layout_constraintVertical_bias="0.352"
tools:text="מבוא לסטטיסטיקה א" />
</android.support.constraint.ConstraintLayout>
Upvotes: 2
Views: 485
Reputation: 54194
There's not a lot of information in your question to use in my answer, but I think you're running into two separate issues:
First, the "right-to-left" behavior of your app will only be triggered if the device is set to use a right-to-left language (like Hebrew). I see that in your layout you have Hebrew text in the statistics
TextView, but if your emulator is set to use the English language, that won't matter. You can see that the device/emulator must be set to a left-to-right language because even system elements (like the hamburger icon) are laying out left-to-right.
Second, tools
attributes have no effect on the runtime behavior of your app. Any view that you've set text to using the tools:text
attribute will have that text stripped away when you actually launch the app on an emulator. So even though you have e.g. tools:text="מבוא לסטטיסטיקה א"
, I would not expect to see any text when you run the app unless you set text programmatically in a place we can't see.
Upvotes: 1