*
The moose likes Android and the fly likes  two different styles in one string ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark " two different styles in one string ?" Watch " two different styles in one string ?" New topic
Author

two different styles in one string ?

chen young
Ranch Hand

Joined: Sep 09, 2005
Posts: 190
Hi,

How can I define the text in a TextView that contain one string with two different styles ?
For example : “Hello World

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41601
    
  55
It's a bit tricky, but possible. Check out the Spannable interface and its implementations. I think you'd use a SpannableStringBuilder to create such a string.


Ping & DNS - my free Android networking tools app
chen young
Ranch Hand

Joined: Sep 09, 2005
Posts: 190
Thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: two different styles in one string ?