I've been researching and was surprised to find out that there was no text wrapping feature. However, I did see many suggest that webview might be an option to display such a thing. I've used webview to load a url, but how would I use it to display a body of text and image that is retrieved from a web service from within the app.
I make a call to the web service, I get the information, then I want to display it. Keep in mind only the top of my activity will have the text and image, so below the webView i'd want to implement some accordian style list view and a view page image gallery.
This is HTML land.
<img align="left" src="[whatever]"/> Put your text here. It should wrap
around your image when it gets to the end. I know somebody will freak and
post the appropriate CSS for this, but whatever. This should work.
Load that into your web view. For referencing the image, you have two basic options. Put the remote URL in the source (this may be very difficult), or save it locally and use "file:///[path to file]".
Related
I have an adapter that have to show HTML content obtained from a server, but I can't use a WebView for each adapter item because performance is terrible...
I think that the only possible solution is to parse each HTML into a TextView.
It looks like that in iOS, DTCoreText library achieves this. Is there any similar library in Android? Html.fromHtml() supports only some tags, and I need to show elements as lists, tables, embedded images and videos, emojis...
Half of what you cite (tables, embedded videos) is not supported by TextView, regardless of how you create the Spannable to show in it.
Hence, use WebView. Using a WebView as an "adapter item" is unlikely to work well; use one WebView for the entire content that you wish to display.
Or, use actual Android layouts for the various pieces, rather than trying to pretend that a TextView is a Web rendering component. Getting the videos to work may be tricky.
I'm displaying a pdf in webview using help of google docs, with this url, https://docs.google.com/gview?url=+location of pdf. It's breaking the pages and giving navigation icons on top right. Is there any way to display all the pages in single flow instead of breaking them.
In the image above, instead of showing in 10 different pages, i want the pdf to be displayed in single flow, I don't want to use navigation buttons on top right.
when &overridemobile=true is appended to URL, this image is being showed.
You can append &overridemobile=true to the url.
Example:
https://docs.google.com/gview?url=www.example.com/example.pdf&overridemobile=true
This will override the mobile viewer and take you to the desktop version, which has a single flow.
all, I am developing a app "forum client", I use the webview as each item in listview for showing the post list, there are pics, texts and some attachments which can be downloaded by user. it does work, but the webview is heavy component, need lots of system resources. so I have to find another method to show the post list. I found this question is the same with my problem, and the last post by author said, use "one webview with bunch of DIVs rendering the individual contents", but I cannot get it, so, what did he mean?
I think he meant that you should get all the HTML that you are showing in the different WebViews in each ListView item, wrap each in a div tag, then show that in one single WebView that the user can scroll. You should get much better performance since you will only have one WebView on-screen (and thus in memory) at one time, rather than one for each visible row which will take a lot of memory.
I'm currently doing a application (project) on android. I would like to know how to create my own buttons in webview, or creating a tab bar in webview. Also, I would want to retrieve certain contents from a website (or rather, from livejournal, to be specifc), like, I do not want the buttons that are in livejournal itself, I just want certain contents, maybe like some live journal posts. Is there any way I could do this?
Thank you so much in advance!
Instead of putting tabs in the WebView you should put the WebView in Tabs. As for pulling information from LiveJournal there are two possibilites. They either have a public api that you can access to get the data you want and use that to populate your app or they don't. If they don't your only recourse would be to pull in the raw html and try to parse it. At that point you might was well just use the webpage as is.
I am sure there is a better way to do what I am doing in my apps. The current one I am trying to improve is a list of military cadences. The way I am doing it now is by loading html files in a web view.
What I would like to be able to do is have one view set up and just be able to add the text portion of what I would be displaying with the html file.
What would be the best method. I know this is probably a pretty simple thing to do with a sting or array but I am at the very beginner level and would need to be pointed in the right direction to do it.
Sounds like you are searching for ListView. You can make a List of what you like tho show to the user and stick that with the an Adapter to the ListView.