Skip to content Skip to sidebar Skip to footer

Textview Won't Break Text

I am having trouble with textView not breaking line before ICS. In ICS (i belive honeycomb works as well but i havent tried it tho) the text inside textView breaks nicely but in gi

Solution 1:

This issue is reported in various forms, here and here for example. Many of the issues reports a previous working layout that gets broken when updating to ICS/holo theme.

I was able to reproduce it easily, it's a matter of a line of xml: @android:style/Theme.Holo

The easiest way to go around it is to introduce a versioned values folder, to let Android pick the right one. In other words You'll have 2 styles.xml:

  • inside values-v11 folder you should put the one you specified (with parent="@android:style/Theme.Holo")
  • inside old values folder you'll put the 'plain' one, with parent="android:Theme.Black.NoTitleBar".

Your manifest should remain unchanged, and Android will pick the right xml based on its version. The solution may not be the most elegant, but at least you won't mess with android:maxlines, android:width and so on

Solution 2:

In addition to Shine answer I had to set corresponding parameters to the TextView:

                android:ellipsize="none"
                android:maxLines="20"
                android:scrollHorizontally="false"
                android:singleLine="false"

Example:

           <TextView                  
                android:textColor="@color/white"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="none"
                android:maxLines="20"
                android:scrollHorizontally="false"
                android:singleLine="false"
                android:text="@string/my_text" />

Post a Comment for "Textview Won't Break Text"