Направление вопроса в числовом тексте с английского на арабский - PullRequest
0 голосов
/ 27 августа 2018

Я занимаюсь разработкой приложения для Android с поддержкой Арабский & Английский Язык

Что касается арабского языка, за мной следовали следующие шаги:

  • Android Studio> Refactor> Добавить поддержку RTL, где это возможно…
  • 2-й я вставлю эту строку в manifest.xml: android:supportsRtl="true"

или

  • Мне изменили свойство макета Left и Right с Start и End

Ничего себе, я счастлив после этих изменений, потому что, когда я выбираю Арабский Язык, какой-то дизайн собирается на LTR, но когда я тестирую свое приложение, я обнаружил некоторые проблемы.

Например, см. Изображение ниже:

enter image description here

Когда я установил RTL День рождения (15/05/1994) отображается как LTR, а весь текст - как RTL (DOB, Gender, City).

Вот проблема, день рождения показывается как 'LTR', тогда ПОЧЕМУ другой EditText не собирается RTL.

Здесь вы можете увидеть мой код:

<RelativeLayout
    android:layout_height="wrap_content"
    android:layout_marginEnd="@dimen/_15sdp"
    android:layout_marginStart="@dimen/_15sdp"
    android:layout_marginTop="@dimen/_12sdp"
    android:layout_width="match_parent">

    <TextView
        android:id="@+id/tv_age"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/_5sdp"
        android:layout_width="wrap_content"
        android:text="@string/dob"
        android:textColor="@color/color_gray"
        android:textSize="@dimen/normal_input_text_size" />

    <EditText
        android:background="@null"
        android:focusable="false"
        android:gravity="end"
        android:id="@+id/edit_dob"
        android:layout_alignParentEnd="true"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/_10sdp"
        android:layout_toEndOf="@+id/tv_age"
        android:layout_width="wrap_content"
        android:singleLine="true"
        android:text="15/05/1994"
        android:textSize="@dimen/normal_input_text_size" />
</RelativeLayout><include layout="@layout/half_view" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_12sdp"
android:layout_marginStart="@dimen/_15sdp"
android:layout_marginEnd="@dimen/_15sdp"
android:gravity="center_vertical">

<TextView
    android:id="@+id/tv_gender"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/gender"
    android:layout_centerVertical="true"
    android:textSize="@dimen/normal_input_text_size"
    android:textColor="@color/color_gray"
    android:layout_marginStart="@dimen/_5sdp" />

<EditText
    android:id="@+id/edit_gender"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toEndOf="@+id/tv_gender"
    android:layout_marginStart="@dimen/_10sdp"
    android:layout_alignParentEnd="true"
    android:gravity="end"
    android:text="Male"
    android:focusable="false"
    android:textSize="@dimen/normal_input_text_size"
    android:background="@null"
    android:singleLine="true" />
</RelativeLayout><include layout="@layout/half_view" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_12sdp"
android:layout_marginStart="@dimen/_15sdp"
android:layout_marginEnd="@dimen/_15sdp"
android:gravity="center_vertical">

<TextView
    android:id="@+id/tv_city"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/city"
    android:layout_centerVertical="true"
    android:textSize="@dimen/normal_input_text_size"
    android:textColor="@color/color_gray"
    android:layout_marginStart="@dimen/_5sdp" />

<EditText
    android:id="@+id/edit_city"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toEndOf="@+id/tv_city"
    android:layout_marginStart="@dimen/_10sdp"
    android:layout_alignParentEnd="true"
    android:gravity="end"
    android:focusable="false"
    android:text="Patan"
    android:textSize="@dimen/normal_input_text_size"
    android:background="@null"
    android:singleLine="true" />
</RelativeLayout>

1 Ответ

0 голосов
/ 27 августа 2018

Попробуйте это.

В RTL, когда вы установили текст как числовой, это происходит.

Свойство LayoutDirection добавлено из API 19, проверьте Ссылка

Добавьте ниже свойство в Edittext.

android:layoutDirection="ltr"

RTL ScreenShot

RTL ScreenShot

Скриншот LTR

LTR Screenshot

Для получения дополнительной информации проверьте справочник Для поддержки RTL

...