How to fill paricular portion of text content with chosen color

by Archana » Wed, 25 Nov 2009 13:53:14 GMT


Sponsored Links
 Hi..
Thanks this link is really useful for me..But i am facing 1 problem
i tried in this way..

TextView text;

Spannable str = (Spannable) text.getText();

str.setSpan(new BackgroundColorSpan(0xFFFFFF00), 3, 12,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

its working fine.But i dont want to set start point and end point as
(3,12).I want to get the length when i click

mouse on particular position in text.

I used event.getx() and getY(),But this will return screen cursor
position only.How can i get length dyanmically ?






--



How to fill paricular portion of text content with chosen color

by Dexter's Brain » Fri, 27 Nov 2009 15:54:32 GMT


 Well, for a textview, you cannot fetch the characters on which the
mouse is residing. I would recommend to use an uun-editable EditText
and the ask the user to first select some text from the Edit Text.

Now, EditText have methods, to let you know what is the start of
selection , and the end of selection.

I guess, I am clear enough.

Thanks,
Dexter.

--


Sponsored Links


How to fill paricular portion of text content with chosen color

by skink » Fri, 27 Nov 2009 20:26:00 GMT


 


yes, you can

see docs about text layouts

pskink

--



Other Threads

1. Custom locking screen

Dear,

We are looking to add a new android locking screen (a password based
one) with the same behaviour of the current unlock pattern.

With some ugly hacks we have been able to create a custom locking
screen but we haven't found a way to disable the home key.

Any ideas ?

Cheers

--
plouck

-- 

2. How can I create TextAppearanceSpan which looks like an anchor

Hi,

Can you please tell me how can I create a TextAppearanceSpan which
looks like an anchor (a blue text with a blue underline under the
text)?

Thank you.

-- 

3. OnActivityResult passing a null intent

4. JetPlayer keeps logging "write blocked for X msecs" - is this normal?

5. Weird stuff - help!

6. Parcel.createStringArray() throwing errors

7. access android.R.string values from xml layout file