I am using a simple textview to show some html string in my android app. If I show only text with links I have no problem, but when I receive some data which contains images and tables the images are showing like obj string only and the tablet are not even shown, only the text part is showing. I know I can use webview, but i don't have so much control of the contents view and I can't customize it so much as in textview.
Is there any way that I can show tables and images in textview, while the images are saved on sd card. I don't need any methods to download them from internet and stuff like that.
Any help / suggestions / advices are appreciated!
No. TextView is not WebView. Use the latter for more markup that elementary attributes like <B>, <U> or tags like <A>
Related
I am developing a small app. I used internal SQLite java class to store data. Data is successfully stored and displaying. I used card-view and recyclerview. All things are working fine. But I want to apply formatting on specif text, which is stored in sqlite. For example some text display as heading , bold etc . Actually text is to large. So i want text display as stylish. I hope you understand my question. Sorry for bad English.
Screen Shoot
You can user basic HTML and turn it into a spanned using SpannableString.fromHtml. then set that Spannable String in a text view and will will show as a stylized html.
I am creating a note application for myself. To style my notes, I write html tags, click a button and show styled version with html. from html.. But the problem is, I need to store the text with html tags not without it so when I get the data from the database, I get the text with style.
So I wonder is there any way to decode embedded html tags other than storing the string before html. from html function and acting accordingly? Also i can click the button anytime then continue typing which is very hard to track. Because i run this function to stylize ;
text.setText(Html.fromHtml(text.getText().toString()));
Which means i lose the tag info.
Thanks in advance.
If the user of the app write the html tags, the app should store them.
So as you suggest yourself, you will have to store the string before calling Html.fromHtml.
Help somebody, I am stuck.
The goal is to view html text with pictures and etc. and to be able catch longClick events on pieces of plain text. And then get this txt and do something with it.
If you are writing a custom application to load html documents then you should have the look at WebView documentation for it. It contains everything to guide you.
I'm creating a note taking app for Android and i would like the user to be able to format their text, i.e. bold, different text sizes.
What I would like to know is how can I do this bearing in mind the text will have to be store-able in a database.
Can i use a web view with a string of HTML i pull from the database and a custom defined CSS to style it on the user end?
I also know there is some sort of formatting class in Android but im unsure of how it work, im not convinced it would be easy to store the formatting information.
I think you should use Spannable text. See android.text.*. I think you should store the text in HTML markup. Also take a look at
http://developer.android.com/guide/faq/commontasks.html#selectingtext
I am writing an android application that will be displaying codes... specially java codes, or maybe jsp code as well. I was thinking about placing these codes in a TextView. However i dont know how to do this for android. I didnt find any tutorial or documentation on how to display formated text in a TextView. I know I can put html in there, so one direction would be format the code itself in html and then place it in the textview.
Is there a better way to do that?
Many thanks
T
TExtView can't do all the formatting. HTML is the best guess.
Search for "Spannable HTML Textview Android" and you will get quite a few examples. Here is one.
Is it possible to have multiple styles inside a TextView?