Search code examples
androidlayouttextviewscrollviewandroid-2.3-gingerbread

Android TextView text cut off only in Gingerbread


The layouts in my application are built using SDK 16 and I've tested and confirmed they work fine on ICS and JB but GB has the following issue:

In the code below, I'm just trying to create a simple layout with only text. The text keeps getting cut off on Gingerbread at the end of the first line though, instead of going on to the next line. I've tried setting singeLine to false, played around with lines, maxLines, marquee, layoutWeight, changing layoutHeight and layoutWidth to every imaginable combination, etc. This issue truly baffles me.

Code:-

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical">

<TextView
    android:id="@+id/textView7"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Text keeps overflowing"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textColor="#33B5E5"
    android:paddingTop="6dp"
    />

<TextView
    android:id="@+id/textView8"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Text gets cut off when I input a long string like this one"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textColor="#FFFFFF"
    />

</LinearLayout>

</ScrollView>

Also, if I change the theme of the layout to Gingerbread, I get the error:

Failed to find style 'scrollViewStyle' in current theme
Failed to find style 'textViewStyle' in current theme
android.content.res.Resources$NotFoundException

Thanks in advance.


Solution

  • Fixed it myself. Couldn't find out why it was happening but I fixed it by adding the following lines to the code for TextViews:-

            android:ellipsize="none"
            android:maxLines="10"
            android:scrollHorizontally="false"