I am trying to format the text on an Android TextView. This is the code I tried in a Java console:
System.out.println(String.format("%-7s 56", "S"));
System.out.println(String.format("%-7s 56", "A(102)"));
The output is the expected, my text is left aligned:
S 56
A(102) 56
No I try the same code on Android TextView:
mTextView.setText(String.format("%-7s 56\n", "S"));
mTextView.append(String.format("%-7s 56", "A(102)"));
And this is the result:
As you can see the output is not the expected the text is not aligned. What I am doing wrong? Is there any other way to do this?