3

I'm currently testing an app on Android 4.0 Ice Cream Sandwich before releasing an update to the market. During the tests I realized that the ellipsize attribute stopped working.

I used it on a list view to truncate item titles which were to long. On Android 2.3.7 everything renders as expected. Titles that are too long get truncated and three dots are append to the end of the string. On Android 4.0 the title gets just truncated after the last word that fits completely on the screen, the rest gets skipped.

I've testes it on a Android 2.3.7 and a Android 4.0.3 phone. This behavior can even be tested in eclipse by changing the Android version in the Graphical Layout editor.

Does anyone has the same problem. Any work a rounds for this?

Flo
  • 27,355
  • 15
  • 87
  • 125
  • 2
    I cannot reproduce your problem. A `TextView` on which I have `android:ellipsize="end"` and `android:singleLine="true"` works for me on Android 4.0.3 just fine. You might consider posting a sample project somewhere that reproduces your error. – CommonsWare Jan 03 '12 at 19:08
  • 2
    I rechecked my style.xml file. It seems as there were some strange attribute constellations which lead to this error. I cleaned it up and add the `android:singleLine="true"`. Now it works! Thanks!!! Before I had maxLines="1", lines="1" and scrollHorizontally="true". Don't ask why!! ;) This app was one of my first ones. – Flo Jan 03 '12 at 19:20
  • Hey I am having the same issue but none of the recommended fixes seem to solve it. Is this a possible but of ice cream sandwich? – MikeIsrael Jan 05 '12 at 08:31
  • I suggest you start a new question an post you layout so other could help you finding the problem. – Flo Jan 05 '12 at 09:26
  • 1
    @Flo: You had this because it was a work-around for `singleLine="true"` and worked on all devices prior to 4.0 – caw Apr 10 '12 at 16:38

3 Answers3

8

android:singleLine="true" works for me.

deloreyk
  • 1,248
  • 15
  • 24
0
enter code here <TextView
    android:id="@+id/tv"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:lines="1"
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:marqueeRepeatLimit="marquee_forever"

    android:scrollHorizontally="true"
    android:singleLine="true"
    android:textColor="#ff4500"
    android:text="Om Namah Shivaya : Om Namah Shivaya : Om Namah Shivaya : Om Namah Shivaya : Om Namah Shivaya" android:layout_marginTop="2dp">

    <requestFocus
    android:duplicateParentState="true"
    android:focusable="true"
    android:focusableInTouchMode="true" />

-1

I can recall I had a similar issue and I could resolve it by setting the TextView(which had ellipsize attribute) gravity to left. But most probably this is another issue.

dmaxi
  • 3,267
  • 1
  • 18
  • 15