I am working on an android app that will be used to learn few technologies from tutorials. Each tutorial will contain several images distributed across the text. Same as like the tutorials we read on websites.
What logic I should use to implement this. The text and images will be fetched from local database.
Check these links for ImageView and TextView in android.To have images in between you need to properly place imageviews between textviews. If you want to add images dynamically and if you are not sure about the number of images you are going to add, build your layout in Activity(or Fragment) class not using xml.
Make html pages out of them and use a WebView to display the html.
Related
I am working on a newsreader app in which we have a Webview to display news details. Can I add an Admob layout between the contents inside this webview?
Basically, it should look like this,
-Webview
-Paragaraph1
-Admob layout
-Paragraph2
-Webview
There should be only one webview and the Admob layout should be inside the webview, placed between content.
I tried with splitting the html content and loading them in multiple webviews inside a Recyclerview. But its affecting the performance a lot.
Any help regarding this would be appreciated.
I think it isn't possible and also it isn't a good practice as you are adding your ads on someone else's data.
And if it is your data you can always change the HTML page
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 want to open multiple tabs within one webview. I can manage to load one url at a time. I am understanding that i have to customized my webview to do so. Is it possible, like as my below picture ?
Any suggestion , tutorial or guideline is appreciated.
Tabs are simply not part of WebView, you need to develop such features around it yourself.
E.g. you could use a TabLayout to implement the tabs, and update the state of the WebView according to the selected tab. You can easily find tutorials all over the place detailing tabs.
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.