The moose likes Android and the fly likes Multiple styles inside a TextView Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Mobile » Android
Reply Bookmark "Multiple styles inside a TextView" Watch "Multiple styles inside a TextView" New topic
Author

Multiple styles inside a TextView

gem gaurav
Greenhorn

Joined: Mar 29, 2011
Posts: 1

hi,

i want to put large text inside textView. The text has multiple section with multiple colours. i have seen Html.fromHtml() function and also know how to use setSpan(). But any of these not work for me. In my case i dont know the id of text View at runtime. As i am inflating different Views at runtime each View has many textViews. It will be better if i can find a way to set styles in strings.

Please some one help me out i have spend so much time here.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Hi and welcome to the Javaranch.

Please read our faq's about KeepItDown & PatienceIsAVirtue.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 4875

"Gaurav Mehta android" please see your private messages regarding an important administrative matter.

It would help if you posted some of the code you tried - ItDoesntWorkIsUseless. I have successfully used setSpan() to apply formatting to text items. Post both the layout you used and the code that calls setSpan.

JBoss In Action
 
IntelliJ Java IDE
 
subject: Multiple styles inside a TextView
 
Threads others viewed
retrieve value from edittext from ListView
Text alignment line by line in android Text-view using Gravity..
styling items of a ListView
Textfield question of an absolute newbie
How to make TextVIew behave like EditText
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com