Implementing a RightMarginSpan/EndingMarginSpan in a TextView

by James Chen » Tue, 25 Jan 2011 02:51:05 GMT


Sponsored Links
 Similar to the LeadingMarginSpan, except it would force a break of 
characters at the ending margin (right margin if text is DIR_LEFT_TO_RIGHT). 
 I want to achieve an effect in the TextView that is similar to the 
BLOCKQUOTE tag from HTML, so that text in the span will break at an 
arbitrarily specified ending margin.  I also (unfortunately) want the 
content to be editable by the user, which rules out using a WebView for this 
type of formatting.


I've been digging through the ASOP 2.3 code and have found that this would 
be a very non-trivial implementation.  From scanning through the code, my 
assumption is that I'd probably have to rebuild several of the functions in 
Layout.java and StaticLayout.java, to explicitly check for that particular 
spanned text during the text measurement and calculations.   It seems like 
these functions would be the most critical to modify:


StaticLayout.java::generate()

Layout.java::drawText()

Layout.java::measureText()


I'm hoping that I might be missing an easier solution and any tips or 
suggestions from anyone would be greatly appreciated.

-- 



Other Threads

1. Dont see my app in share menu for Picasa images in galary

Try this one.

                        <intent-filter>
                                <action 
android:name="android.intent.action.SEND"></action>
                                <category 
android:name="android.intent.category.DEFAULT"></
category>
                                <data android:mimeType="image/*"></data>
                                <data android:mimeType="video/*"></data>
                        </intent-filter>

Thanks and Regards,
Kumar Bibek




-- 

2. BroadcastReceiver not recei ving an alarm鈥檚 broadcast

Ok, I found the problem, hope this thread helps somebody else with the
same stupid errors:

My <receiver> was inside the <manifest> but outside the <application>
tags :-/




-- 

3. mini2440 Android bring-up instructions including files

4. Input question.

5. Application not installed on Hero

6. A new site to open blocked sites, and forbidden

7. android.location.Location.distanceTo algorithm