Created
May 4, 2016 12:16
-
-
Save carlol/ab791a5f21cf9e58028db2668619aabe to your computer and use it in GitHub Desktop.
Custom TextView to manage html text in xml layout #android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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