Simple HTML (or XML) to Android Converter

I have a very simple data format that I want to display often in my application. The first approach is to use native Android components such as TextView, ImageView, and TableLayout. But this approach forces me to create many different user interfaces. The second approach is to use WebView. Thus, I will lose speed. WebView is very effective for such purposes, but it kills the user interface. The third way is to use (very simple) HTML or XML and convert them to native Android UI elements at runtime.

For example, suppose 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> 

in it:

 <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 creating such an HTML (or XML) converter?

+6
source share
2 answers

So, if you understand your question correctly, you need a tool to create an application using HTML and other web technologies.

One of the things I can recommend is PhoneGap Build by Adobe, basically you upload your HTML file and configuration file (instructions in the documentation) to the website, and then convert it to the application file. This can be used to create both Android and iOS (requires a signature certificate) is relatively easy.

This alone does not hide your HTML in the android XML, but allows you to create an interface in HTML that can then be compiled and compiled into the application.

PhoneGap Build Link: https://build.phonegap.com

There are other tools that use the same environment (Cordova) to achieve this, but I found that this is the easiest and most user-friendly way to do this.


Although this answer is late, I hope it ultimately helps someone!

Feel free to comment on any additional questions or requests, and I will be happy to contact them.

0
source

I think this is what you (or someone need) is looking for:

squarede

Converts and optimizes pure HTML and SVG into various standard Android layouts in XML. The easiest to use and also the most accurate with support for CSS / SMIL animations. Compatible with Chrome and Safari.

And yes! I know this is an old post.

0
source

Source: https://habr.com/ru/post/980064/


All Articles