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. Error on AndroidManifest.xml..

Hi, all.

  I'm trying to build the full Cupcake source code,
  And succeeded on my local Linux box.
  But once I copy the same source code to the remote server (Linux
based server)
  it returns the error like as below.

  target R.java/Manifest.java: Development (out/target/common/obj/APPS/
Development_intermediates/src/R.stamp)
  development/apps/Development/AndroidManifest.xml: 74: ERROR Error:
String types not allowed (at 'configChanges' with value 'keyboard|
keyboardHidden|navigation|orientation').
  make: *** [out/target/common/obj/APPS/Development_intermediates/src/
R.stamp] Error 1

  I tried ro delete out folder and 'make clean' also, but failed.

  Please tell me why the same source code return the error like the
above only in the remote server.
  Again, the smae one had been built on my local Linux box (Ubuntu).

  Thanks in advance.
  Shwan.


--~--~---------~--~----~------------~-------~--~----~

2. capture dialer events

Hello,

I'm trying to figure out if there is a way to capture an event from
the Dialer, after I've entered and clicked on the phone number, but
before the call is actually placed? I also want to be able to access
the phone number that was put in?

I'm trying to make a simple call logger application, but I can't seem
to find any examples of how to do this.

any help would be greatly appreciated it.

Thanks!

Mike

--~--~---------~--~----~------------~-------~--~----~

3. Dynamically adding Images to GridView

4. where can i modify ro.kernel.android.gps ?

5. Question about TabHost implementation

6. asking about previous SDK Versions

7. Uninstall built-in app