I'm programmatically creating StaticLayouts with varying strings, and then applying each to a bitmap that is then added to a canvas. The SL displays up to two lines before getting cut off by the fixed height that I defined in the SL constructor. But there is no ellipses to indicate that the text is longer than what is shown.
From http://developer.android.com/reference/android/text/StaticLayout.html I see that the third constructor has truncation arguments at the end:
StaticLayout(CharSequence source, int bufstart, int bufend, TextPaint paint, int outerwidth, Layout.Alignment align, float spacingmult, float spacingadd, boolean includepad, TextUtils.TruncateAt ellipsize, int ellipsizedWidth)
I know I'd like TextUtils.TruncateAt.END
, but I can't figure out what I should be defining for bufstart
, bufend
, and ellipsizedWidth
. I couldn't find any good examples of this constructor in particular, or if it will even help achieve my goal.
Not 100% familiar with Android, but have had the same issue myself and this is what I've found:
Sorry for a not-so-confident answer, but I'm still learning!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With