Tuesday, 12 January 2021

Is it possible to have TextView with maxLines=2 but if the text has one single long word not break it in 2 lines?

I have a TextView and I set text which I receive from Backend. the text is either from 1 to 3 words. Maximum the textview can be 2 lines. I am using setAutoSizeTextTypeUniformWithConfiguration and text.breakStrategy = LineBreaker.BREAK_STRATEGY_SIMPLE
And I don't have any success. wondering is it possible if the text is single word I don't want to split it. I would like to have it in single line with small textSize. if the text is 2 words and long I am fine to show it in 2 lines. The problem is it always breaks the word in 2 lines if it is long while I don't want.



from Is it possible to have TextView with maxLines=2 but if the text has one single long word not break it in 2 lines?

No comments:

Post a Comment