【问题标题】:Cursor side after hint on RTL language提示 RTL 语言后的光标侧
【发布时间】:2015-09-02 14:18:16
【问题描述】:

我已编辑带有提示的文本,并尝试将我的 editText 左对齐(使用 rtl 语言),但我希望我的光标位于行首。到目前为止还没有运气...... 有什么建议吗?

我的屏幕

xml

    <com.fibi.ui.views.edit_text.FibiEditText
        android:id="@+id/userCodeEditText"
        android:layout_width="match_parent"
        android:layout_height="41dp"
        android:background="@drawable/bg_alpha_top_radius"
        custom:hintText="@string/login_user_code"
        android:lines="1"
        android:maxLines="1"
        android:paddingRight="13dp"
        android:singleLine="true"
        app:customFont_fibiRditText="@string/reforma_regular"
        custom:textColor="@color/t7" 
        custom:hintTextColor="@color/t7" />

    <com.fibi.ui.views.edit_text.FibiEditText
        android:id="@+id/passwordEditText"
        android:layout_width="match_parent"
        android:layout_height="41dp"
        android:layout_below="@+id/userCodeEditText"
        android:background="@drawable/bg_alpha_no_radius"
        custom:hintText="@string/login_password"
        custom:inputType="password"
        android:lines="1"
        android:maxLines="1"
        android:paddingRight="13dp"
        android:singleLine="true"
        app:customFont_fibiRditText="@string/reforma_regular"
        custom:textColor="@color/t7" 
        custom:hintTextColor="@color/t7" />

</RelativeLayout>

在我的 java 文件中,我有这些行:

editText.setGravity(Gravity.LEFT);
editText.setEllipsize(TextUtils.TruncateAt.END);
editText.setInputType(InputType.TYPE_CLASS_TEXT);

【问题讨论】:

    标签: android android-edittext cursor right-to-left


    【解决方案1】:

    我不知道我是否理解正确,但是您是否要将光标放在编辑文本的开头?如果是这样的话……

    editText.setSelection(0);
    

    【讨论】:

      猜你喜欢
      • 2016-05-24
      • 1970-01-01
      • 1970-01-01
      • 2016-03-29
      • 1970-01-01
      • 1970-01-01
      • 2017-11-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多