android:maxWidth - Set the Maximum Width of TextView

How to Set the Maximum Width of a TextView

android:maxWidth was added in API Level 1

Makes the TextView be at most this many pixels wide. Must be a dimension value.

1. Add a TextView in the main.xml file.

2. In the main.xml file, add the code below.

<TextView
        ...
android:maxWidth = "20sp"
/>

3. Ensure the  android:layout_width in the TextView is set to "wrap_content".
If android:layout_width is set to "match_parent" = "match_parent" will override the android:minWidth setting.

4. Compile and run!
http://developer.android.com/reference/android/widget/TextView.html#attr_android:maxWidth
http://developer.android.com/reference/android/R.attr.html#maxWidth