Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android supportsRtl makes negative num view with minus after the number

When adding on my androidManifest: android:supportsRtl="true" my TextView with text "-1390" is shown as "1390-"

how can I fix it?

(edit) This is my current problematic textView:

 <TextView
                android:id="@+id/header_account_balance"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="left"
                android:inputType="numberSigned"
                android:text="\u200F -10,452"
                android:textAlignment="gravity"
                android:textColor="@color/black"
                android:textDirection="rtl"        *ltr did not work as well*
                android:textSize="26sp"
                android:textStyle="bold"/>
like image 749
Guy-Avraham.com Avatar asked Oct 28 '25 09:10

Guy-Avraham.com


2 Answers

I know this is an old question, but for those who need an answer, just try to wrap you number with:

"\u202D your number \u202C"

This will do the work.

like image 109
Igor Fridman Avatar answered Oct 31 '25 11:10

Igor Fridman


You can override this behavior by specifying android:textDirection="ltr" on the TextView. You can also set that attribute on the root ViewGroup of your layout, if you want all of the textual Views it contains to layout their text left-to-right.

like image 42
Mike M. Avatar answered Oct 31 '25 12:10

Mike M.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!