Question

I am using an EditText to display text received from a serial port which is updated 10 times a second, it works fine but one of the lines of text has a character that alternates beyween a digit and a dash (-). Becuase the dash is narrower than the digit the rest of the line of text after this character jumps right-left as the digit and dash alternate.

How can I prevent this so either the digit or dash could be displayed without the rest of the line jumping?

TIA

Was it helpful?

Solution

You should use monospace font. You can either change it with the visual designer or by code:

EditText1.Typeface = Typeface.MONOSPACE

Visual designer:

Visual designer:

OTHER TIPS

You then should probably use monospace font:

<EditText android:typeface="monospace" [rest of attributes] />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top