Установите TextView
свойства:
android:textAlignment="viewStart"
ИЛИ
android:textDirection="ltr"
При использовании этих свойств всегда начинается текст сслева направо.
Я использую для этого, включая макет в navigationView
, которым я легко могу управлять для локализации.
Как это
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginEnd="-65dp"
android:layout_marginRight="-65dp"
android:fitsSystemWindows="true">
<include
layout="@layout/nav_header_main_navigation"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.design.widget.NavigationView>
nav_header_main_navigation
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/app_gray"
android:gravity="bottom">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/rlTop"
android:layout_width="match_parent"
android:layout_height="88dp"
android:layout_alignParentTop="true"
android:background="@color/appYellow">
<TextView
android:id="@+id/tvName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="24dp"
android:layout_marginEnd="30dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="30dp"
android:layout_marginStart="24dp"
android:ellipsize="end"
android:includeFontPadding="false"
android:maxEms="14"
android:maxLines="2"
android:textColor="@color/app_gray"
android:textSize="15sp" />
<RelativeLayout
android:id="@+id/rlBack"
android:layout_width="30dp"
android:layout_height="20dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="20dp"
android:clickable="true">
<ImageView
android:id="@+id/ivBack"
android:layout_width="10dp"
android:layout_height="20dp"
android:adjustViewBounds="true"
android:clickable="true"
android:scaleType="centerCrop"
android:src="@drawable/back_icon_black" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlBottom"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/rlTop"
android:background="@color/app_gray">
<RelativeLayout
android:id="@+id/rlProfile"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="10dp">
<ImageView
android:id="@+id/ivProfile"
android:layout_width="19dp"
android:layout_height="19dp"
android:layout_centerVertical="true"
android:layout_marginLeft="24dp"
android:layout_marginStart="24dp"
android:src="@drawable/icon_nav_profile" />
<TextView
android:id="@+id/tvProfile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_toEndOf="@id/ivProfile"
android:layout_toRightOf="@id/ivProfile"
android:includeFontPadding="false"
android:paddingBottom="1dp"
android:paddingTop="1dp"
android:text="@string/profile"
android:textAlignment="viewStart"
android:textColor="@color/white"
android:textDirection="locale"
android:textSize="15sp" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
это пример того, как вы можете легко избегать меню и использовать обычные макеты.
Здесь приведены дополнительные ответы относительно приведенного выше примера URL