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. Want to execute arm compiled executable file on Android adb shell



I may be wrong, but I think the sdcard is mounted with the NOEXEC
flag, so you can't run programs from there. The best way is to
integrate the executable into your app as a native library using the
NDK.

-- 

2. Harga broadband 3 tetap 85rb/bl

Khusus pelanggan lama yg daftar dari waktu masih 85rb/bln.. ada yg denger
hal yg sama?

Gw sih td dtelpon ma 3care, awalnya dblgin ada promo nelpon gratis 3 hari ke
sesama 3 klo isi ulang.. trus gw blg mo cuti dulu pake broadband-nya 1 bln
(mo ngungsi sebulan ke oz, dsuru nyangkul dsono ma kantor), abis itu dpt
tambahan info yg di atas.. jd batal cuti 1 bln-nya deh.. :P

Smoga gw ga salah denger infonya..

..nexus...@cyanogenmod-5.0.6..

-- 
"Indonesian Android Community [id-android]" 

3. Anyone interested in trading and N1 for Droid

4. Android Developer Device Seeding Program - still active?

5. CheckedListView sparse boolean array

6. phone-as-client Socket connections time out in 3GS mode, but work fine in wifi

7. Ask:HTC Dream G1..masih bisa apa?