Java – Use different font styles in TextView

Use different font styles in TextView… here is a solution to the problem.

Use different font styles in TextView

I can display the contents of the file in TextView by adding the file under the raw folder and reading the file. It works fine. But everything in the file looks the same. I want to differentiate between headings and content by introducing font styles. Can someone help?

Solution

I understand from your question that you want to apply different formatting to different parts of the TextView Chinese. But as far as I know, TextView doesn’t yet support multiple styles (formats). Whatever formatting you apply, it applies to the entire text in the TextView. To use different formats, you can use the WebView .

Update:

This feature is unique to EditText (I saw it too late), see this link for details; http://developer.android.com/resources/faq/commontasks.html#selectingtext

Related Problems and Solutions