textDirection没有使编辑文本从右到左

问题描述 投票:0回答:2

我正在创建需要文本rtl的应用程序,即下面的阿拉伯语是我的代码

<com.google.android.material.textfield.TextInputLayout
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginLeft="@dimen/dimen_24"
    android:layout_marginTop="@dimen/dimen_36"
    android:layout_marginRight="@dimen/dimen_24"
    android:hint="@string/password"
    app:hintTextColor="@color/hint_text_color"
    android:textDirection="rtl"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:passwordToggleEnabled="true"
    android:textAlignment="viewEnd">

    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:imeOptions="actionDone"
        android:inputType="textPassword"
        android:maxLines="1"
        android:textColor="@color/dark_blue_grey"
        android:textSize="@dimen/font_16" />
</com.google.android.material.textfield.TextInputLayout>

但是不过,我只能在用户界面下得到它>

enter image description here

我也将应用程序语言环境更改为ar,但仍然相同。

我正在创建一个需要文本rtl的应用程序,即下面的阿拉伯语是我的代码] >>>>

请尝试:

android:textAlignment="viewStart" 

在TextInputEditText中。它对我有用。

过去我遇到过类似的问题,就像我在TextInputEditText元素中使用了gravity属性一样。

android:gravity="right"

希望有帮助。

android kotlin right-to-left
2个回答
0
投票

请尝试:


0
投票

过去我遇到过类似的问题,就像我在TextInputEditText元素中使用了gravity属性一样。

android:gravity="right"

希望有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.