As you can see in attached images, line 1 has two words, line 2 has 4 words and last line has one word.
But they all have equal width irrespective of different text size and word count.Can anyone help me to achieve this?
Asked
Active
Viewed 107 times
-1

Charlize Smith
- 59
- 1
- 9
1 Answers
0
use AppCompatTextView
and set android:autoSizeTextType="uniform"
, android:maxLines="1"
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/textView"
android:layout_width="400dp" <!--fixed size-->
android:layout_height="200dp" <!--fixed size-->
android:autoSizeTextType="uniform"
android:maxLines="1"/>

Ehsan msz
- 1,774
- 2
- 13
- 26
-
I have tried above code for achieving the thing, it didn't worked out. Can you help with the solution? – Charlize Smith Nov 15 '19 at 06:54
-
@JohnSmith what is the value of `width` and `height` in your TextView ? – Ehsan msz Nov 15 '19 at 16:40
-
– Charlize Smith Nov 18 '19 at 07:05
-
@JohnSmith set `height` to higher value – Ehsan msz Nov 27 '19 at 16:34