7

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.

Community
  • 1
  • 1
r2DoesInc
  • 3,759
  • 3
  • 29
  • 60
  • I've found that on devices with a track pad or something similar I can set the ellipsesize to marquee and enable horizonalscrolling but that only works if the user uses the track pad to select it. No way to do that with touch afaik. – r2DoesInc Mar 21 '12 at 00:07
  • Even got it scrolling everything now. Its a work around, but I'd still like to know what's actually causing it. – r2DoesInc Mar 21 '12 at 00:26
  • Someone was unable to reproduce this on stock froyo. Gingerbread is all I can currently vouch for. – r2DoesInc Mar 21 '12 at 19:39
  • This is one of those problems that would really help to see and debug the whole thing. Could you perhaps create a basic Eclipse project with the relevant code where this issue is visible to you and share it? – rfgamaral Mar 23 '12 at 14:05
  • @Ricardo ive updated it with an example project – r2DoesInc Mar 23 '12 at 19:28

1 Answers1

6

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.

Blundell
  • 75,855
  • 30
  • 208
  • 233