How to set maximum characters per line for text view in android
Using
android:maxWidth="size"
Replace the "size" with the size you prefer. For example, 100dip
.
Set these parameters of TextView:
android:layout_width="110dip"
android:singleline="false"
Experiment with the value of android:layout_width
to find the value that fits your needs.
use android:maxWidth="10dip"
to limit the size of the textview.
With this limitation the next line (assume you used setSingleLine(false)
) will start right after the 10dip
.
Using android:maxLength="50"
for example would limit your textview, but doesn't ensure that it breaks after X characters
Use this
android:maxLength="10"
For more Information refer this site