Android Question Formating text parts from Text File

rafaelbr20

Member
Licensed User
Longtime User
Hi Everyone,

I'm reading a long text from .TXT file, and i would like to format some parts as bold.

For example, i would like to put all Title Paragraphs as bold.

There is some tag i can put inside this specific parts and than label will read and than format text ? Something like HTML tags for example ...

I´m planing to use label to show the text ... there is some other component better than label ?

Ex:
<strong>Title</strong>
text text text
text text text
text text text

I´m using TextReader to read text file ...

Code: Copy
    Dim tr As TextReader
    tr.Initialize2(File.OpenInput(File.DirAssets, "file.txt"), "ISO-8859-1")
    Dim lines As String = tr.ReadAll
    tr.Close
    lbl.Text = lines

THanks so much !
 
I´m using TextReader to read text file ...
This is a mistake. You should use File.ReadString or ReadList.

1. You can use html tags and show the text with WebView.
2. You can use RichString library. It also supports tags. You can then show the text with CustomListView.AddTextItem.
 
Upvote 0
This is a mistake. You should use File.ReadString or ReadList.

1. You can use html tags and show the text with WebView.
2. You can use RichString library. It also supports tags. You can then show the text with CustomListView.AddTextItem.

Thaks Erel !

I Don´t use File.ReadString because i need to encoding. My text files are not in UTF-8.

It works very well with RichString library !

Code: Copy
    Dim tr As TextReader
    tr.Initialize2(File.OpenInput(File.DirAssets, "file.txt"), "ISO-8859-1")
    Dim lines As String = tr.ReadAll
    tr.Close
    rsString.Initialize(lines)
    rsString.Style2(rsString.STYLE_BOLD,"<b>")
    rsString.Color2(Colors.RGB(74,114,178),"<m>")
    lblTextoNovena.Text = rsString
 
Upvote 0
Back
Top