eleven
eleven

Reputation: 6847

Underlined TextView is not anti-aliased

When trying to make text underlined:

setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);

TextView becomes non anti-aliased. If I enable anti-aliasing:

getPaint().setAntiAlias(true)

Then it becomes anti-aliased.

Is there some connection between anti-aliasing and Paint.UNDERLINE_TEXT_FLAG?

enter image description here

Upvotes: 1

Views: 497

Answers (1)

Sujay
Sujay

Reputation: 3455

There is no connection betwenn anti-aliasing and Paint.UNDERLINE_TEXT_FLAG .

But the difference is that setPaintFlags(Paint.UNDERLINE_TEXT_FLAG) will remove default existing flags & set the current flag as Paint.UNDERLINE_TEXT_FLAG only. Try the below code to keep existing flags & add new flag

yourTextView.setPaintFlags(yourTextView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);

Upvotes: 1

Related Questions