开发者

Text Display Jumping Left-Right due to character width difference

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开发者_JS百科 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


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

EditText1.Typeface = Typeface.MONOSPACE

Visual designer:

Text Display Jumping Left-Right due to character width difference


You then should probably use monospace font:

<EditText android:typeface="monospace" [rest of attributes] />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜