Search code examples
androidandroid-edittextandroid-inputtype

RTL EditText broken pointer issue in Android


In rtl layout, edittext pointer gets broken in android devices.

I have an application which supports English and Arabic languages. In that the edit text fields with input type number is having this issue mainly. While entering numbers in edit text field, the pointer will break into two halves as shown in the image.

This is the xml code of the edittext.

    <EditText
            android:id="@+id/et_budget"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="15dp"
            android:background="@drawable/white_background_theme_border"
            android:ems="10"
            android:gravity="center"
            android:hint="@string/choose_budget"
            android:inputType="number"
            android:padding="15dp"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColorHint="@android:color/black" />

pointer break

Have someone experienced this issue. Is there any fix for the same. Thanks in advance.


Solution

  • Have you tried this

    Layout

    <EditText>
        ... 
        android:gravity="right"
        android:textDirection="rtl"
    </EdiText>
    

    AndroidManifest.xml

    <application
        ...
        android:supportsRtl="true">
        ...
    </application>