PriceyUK
PriceyUK

Reputation: 2027

Android Development: Line Spacing With Line Numbering

In my app I have line numbers to the left of an EditText - everything is great so far, the line numbers are perfectly aligned with the lines of the EditText.

The problem is, if the user changes the text size of the EditText the line numbers aren't aligned properly. So I've added code so when the text size of the EditText is changed, the line numbers text size is changed too; but that causes another problem: if the user picks a big text size, the line numbers hog all the space, so there's barely any room to write in the EditText.

The only solution would be to set line spacing. So I eventually came across the setLineSpacing() function, and have tried using it based off tutorials but I don't understand how it works and can't get it aligned with the EditText's lines.

Can someone help me understand how to use it, or suggest a different way of getting each line in the line numbers TextView aligned with the EditText's lines?

Sorry if this is confusing, I'm not very good at explaining things well sigh.

Thanks, Alex.

Upvotes: 0

Views: 585

Answers (1)

Akshay
Akshay

Reputation: 5765

I faced a similar situation in the past, in which the EditText's size was limited. It was decided that the max font size that can be chosen should be limited to a value in which the visual appearance does not look ugly. I feel it is useless to plug cases that can occur but don't make sense. It is better to block such cases. Perhaps you can think along these lines.

HTH,

Akshay

Upvotes: 2

Related Questions