Android TextView Multiline Formatting -


these 2 line logcat strings formatted string.fortmat()

04-19 13:57:44.918 26962-26962/ts.kiosk.app.checkout e/java.lang.stacktraceelement: "tendered amount:                    rs.     0.00" 04-19 13:57:44.919 26962-26962/ts.kiosk.app.checkout e/java.lang.stacktraceelement: "change due:                         rs.     0.00" 

you can see both line same exact length in text view string not formatted be:

string.format("%-25s rs. %2$8.2f", "tendered amount:", formatcentstocurrency(checkoutbasket.tenderedamount));  string.format("%-25s rs. %2$8.2f", "change due:", formatcentstocurrency(checkoutbasket.changedue)); 

so how aligned in textview:

"tendered amount:                       rs.     0.00" "change due:                         rs.     0.00" 

i'm thinking textview messing formatting somewhow:

                       <textview                         android:id="@+id/text_receipt"                         android:layout_width="wrap_content"                         android:layout_height="match_parent"                         style="@style/popupreceipttext"                       android:text="@string/popup_detail_description_default"                         android:gravity="left"                         android:layout_gravity="center_horizontal"/> 

actual textedit

for me correct answer, , simple should have discovered earlier:

i added:

android:typeface="monospace" 

to textview


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -