I can display the contents of a file in a TextView
by adding the file under the raw folder and reading the file. It works fine. But all of the contents in the file look the same. I want to differentiate titles and the contents by introducing Font styles. Can anybody help?
What I understood from your question is that you want to apply different formatting to different parts of your text in TextView. But As I know, TextView doesn't supports multiple styles (formatting) (yet). Whatever the formatting you apply, will be applied to the whole text in TextView. To use different formatting, you can use the WebView.
Update:
This functionality is available for EditText (I saw it too late), see this link for details; http://developer.android.com/resources/faq/commontasks.html#selectingtext
You can use WebView
instead as your text is static you can format it to create a htmlPage and then display it in webview
something like this
WebView mView = (WebView) findViewById(R.id.help_text);
mView.loadUrl("file:///android_asset/help.html");
mView.getSettings().setSupportZoom(false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With