So i know that a lot of time passed, but i've found a way to preview the HTML in the Layout editor in Android Studio (don't know about Eclipse though).
So i just created a custom TextView callet HtmlTextView:
public class HtmlTextView extends TextView {
public HtmlTextView(Context context) {
super(context);
}
public HtmlTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public HtmlTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void setText(CharSequence text, BufferType type) {
Spanned html = null;
if(text != null) {
html = Html.fromHtml(text.toString());
super.setText(html, BufferType.SPANNABLE);
} else {
super.setText(text, type);
}
}
}
After that it's just a matter of using it:
<com.example.app.custom.views.HtmlTextView
android:text="@string/your_html_string"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
The string resource looks like this:
<string name="your_html_string"><![CDATA[My <b><font color=\'#E55720\'>AWESOME</font></b> html]]></string>
Hope it helps someone!