You might be able to achieve what you want with a LineBackgroundSpan
which is a ParagraphStyle.
See 
http://developer.android.com/reference/android/text/style/ParagraphStyle.html

On Jan 20, 6:02 am, Vi7ER <[email protected]> wrote:
> Hi,
>
> I am trying to write an app that involves paragraphs of text which I
> would like to display images behind. What I mean by this is that
> within a paragraph I would have (for example) the first 3 words with a
> certain background (ideally a nine-patch style image) then the next 1
> word with a different image and the last 7 words with a another image.
>
> Now I know I can achieve a rudimentary version of this with setSpan
> and BackgroundColor. But instead of a colour I want to set an image as
> the spans background.
>
> I need to do it in a TextView because I require the wrapping of text
> to occur as normal. Or in other words I need these image spans to be
> able to cope with being split across 2 lines. Just like a selection
> can be.
>
> I've toyed with using a combination of LinearLayouts, and TextViews to
> represent spans (which makes the 9 patch easier) but this method makes
> it tricky to work out how to split the textviews across lines (as the
> linear layouts work in only one direction).
>
> I hope you get what I mean here :)
>
> If anyone has any idea how I can achieve this I would be very
> grateful! I've looked at the available spannable objects here 
> :http://developer.android.com/resources/faq/commontasks.html#selecting...
> but I can't find one that seems to do what I want (the descriptions of
> what they do are a little lacking mind).
>
> Well, fingers crossed.... :)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to