Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Long text goes to next line on ICS, but not on GB and below

The first time I noticed this was with AlertDialogs putting the entire message on the first line, even when I specified a new line("\n"). On ICS it displays the correct way, but for the life of me, I couldn't get it to work on GB.

Recently I've run into it again. I don't see any reason for it working fine on ICS but not GB and below.

EXAMPLE Project

Heres an example project with a textview, alertdialog, and two standard textviews.

https://github.com/T3hh4xx0r/Text-Example

EDIT

Heres the original question I asked. Seems the problem is more than I originally noticed though.

Android AlertDialog not displaying entire setMessage on certain devices

/EDIT

Here are visual examples of what I mean.enter image description here

Even specifically setting multiple lines for the textView, the text is still one line, but with extra blank lines below.

like image 331
r2DoesInc Avatar asked Mar 20 '12 21:03

r2DoesInc


1 Answers

Here is the layout that the alertdialog is using to create your view:

<!--
    This layout file is used by the AlertDialog when displaying a list of items.
    This layout file is inflated and used as the TextView to display individual
    items.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/text1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="@android:color/primary_text_light_disable_only"
    android:gravity="center_vertical"
    android:paddingLeft="14dip"
    android:paddingRight="15dip"
    android:ellipsize="marquee"
/>

As you can see the ellipsize is set to marquee, so I don't believe it was ever written with the intention to allow multilines.

There is a bug open at the moment that ellipse dots are never shown: http://code.google.com/p/android/issues/detail?id=10554

Therefore it is acting correctly.

If you want it to go onto multiple lines, create your own layout file and pass that to your dialog, that way you have more control anyway.

like image 160
Blundell Avatar answered Oct 23 '22 03:10

Blundell