Problem with string alignment [duplicate]

-1

I have a problem with my Android project that I can not resolve. I have a series of strings that are summed to form a larger string as in the following example:

String teste1 = "O.P.                Processo            Célula";
String teste2 = "20350               A                   005";

However, when the screen is displayed, the letter A and 005 do not fall under the words "Process" and "Cell". I even pasted this code into Skype to pass on to a person and it did not come in line too. Why does this occur?

    
asked by anonymous 28.01.2014 / 15:12

1 answer

9

For this you need to use monospaced fonts, such as Courier.

Monospaced fonts, unlike proportional fonts, are those in which all letters have the same widths. See the comparison:

Example 1

XMILSW
WWMWMW
i01 .m

Example 2

XMILSW
WWMWMW
i01 .m

Notice that in the first case the letters do not align and the second one does.

Take a look at the typeface MONOSPACE documentation to see some options for that.

  

Consider the Grid View instead. Grid View allows you to have multiple separate columns, aligned regardless of content.

    
28.01.2014 / 15:17