How to use SpannableString with scrolling widgets?

134 views
Skip to first unread message

Mark

unread,
Aug 1, 2011, 5:42:25 PM8/1/11
to android-appwidget-extensions
Hi,

I'm using spans to indent text like this:
___timetext some long description which
______wraps around and flows to the
______following lines.

This works fine in a normal appwidget using SpannableString and
LeadingMarginSpan.Standard(first_line_indent_amount,
following_lines_indent_amount)
and then
views.setTextViewText(viewId, ssSpannableString);

But how to do that with with a DataProvider?
I tried TYPES_TEXTVIEW and TYPES_TEXTVIEWHTML
and provided the spanned string as a string, a html string and also as
a CharSequence.

Using normal strings all formatting is lost.
Using html the color is preserved but indentation doesn't work
(because html doesn't know indentation without CSS)
With charsequence all formatting is lost.

Any ideas?

Mark

Mark

unread,
Aug 1, 2011, 5:46:16 PM8/1/11
to android-appwidget-extensions
It seems this
http://groups.google.com/group/android-appwidget-extensions/browse_thread/thread/195a524b8e0a293e
handles the same topic. Sigh, and I really searched before posting.
So if I understand the other article correctly I would have to wait
for V3?

roee88

unread,
Aug 1, 2011, 6:33:41 PM8/1/11
to android-appwidget-extensions
Hi Mark,

Actually V3 also uses Html.fromHtml internally so it won't work
either, sorry.

Question to devs:
Is it possible to serialize a Spanned object into a byte array without
loosing its attributes ?
I guess it could be possible to use the Spanned.getSpan* methods to
enable serialization, then store it as byte array in ExtMatrixCursor
and deserialize it back on the launcher's side.
Any thoughts ?

On Aug 2, 12:46 am, Mark <android.eggenst...@googlemail.com> wrote:
> It seems thishttp://groups.google.com/group/android-appwidget-extensions/browse_th...
Reply all
Reply to author
Forward
0 new messages