Skip to content

Instantly share code, notes, and snippets.

@carlol
Created May 4, 2016 12:16
Show Gist options
  • Select an option

  • Save carlol/ab791a5f21cf9e58028db2668619aabe to your computer and use it in GitHub Desktop.

Select an option

Save carlol/ab791a5f21cf9e58028db2668619aabe to your computer and use it in GitHub Desktop.
Custom TextView to manage html text in xml layout #android
public class HTMLTextView extends TextView {
public HTMLTextView(Context context) {
super(context);
this.init();
}
public HTMLTextView(Context context, AttributeSet attrs) {
super(context, attrs);
this.init();
}
public HTMLTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.init();
}
private void init() {
setText(Html.fromHtml(getText().toString()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment