I have a very simple data format that I want to frequently display that in my app. The first approach is using native android components like TextView, ImageView and TableLayout. But this approach makes me create a lot of different UIs. Second approach is to use WebView instead. This way I will lost speed. WebView is very powerful for such purposes but it kills UI responsiveness. The third way is to use a (very simple) HTML or XML and convert them to native android UI elements at runtime.
For example assume that I want to convert this simple html:
<div style="some_div_style">
<p style="some_paragraph_style">A not-very-long-text comes here</p>
<img src="..."/>
</div>
into this:
<LinearLayout style="@style/some_div_style">
<TextView style="@style/some_paragraph_style" android:text="A not-very-long-text comes here"/>
<ImageView android:src="..." .../>
</LinearLayout>
at runtime.
Do you know any library for doing such HTML (or XML) converter?
yes it is possible you can design whole page in html and stored in Asset folder with image used,css,script folder,and in android activity you just open it in webView . Save this answer.
Terminology. eXtensible Markup Language, or XML: A markup language created as a standard way to encode data in internet-based applications. Android applications use XML to create layout files. Unlike HTML, XML is case-sensitive, requires each tag be closed, and preserves whitespace.
I think this is what you (or anyone need this) looking for:
squarede
Converts and optimizes pure HTML and SVG into the various standard Android layouts in XML. Easiest to use and also most accurate with support for CSS/SMIL animations. Compatible with Chrome and Safari.
And yes! I know that it is an old post.
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