SpannableString in android

Save

The SpannableString in android is a powerful way to beautify and manipulate different part of a simple text.

 

What is SpannableString?

 

This is the class for text whose content is immutable but to which markup objects can be attached and detached.

 

This implies that for a immutable content/string , we can provide different markup objects like URLSpan, ForegroundColorSpan, RelativeSizeSpan, ImageSpan, BackgroundColorSpan , ClickableSpan etc.

 

How to manipulate only a part of string by using SpannableString?

It is same as how it is done in the web

1. Creating a ClickableSpan

2. Creating a SpannableString

This will set the click action to a particular portion of the text.

3.  Setting SpannableString to TextView

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

All communication is done through a ticket system. I appreciate the regular almost daily updates of what is being worked on, and communicating changes or updates is easy through this system. Mobikul's response timeframe is quick.

Josh Arnold

Josh Arnold

Owner, Shop ATV Escape

Talk to Sales

Global

Live Chat
Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home