open-keychain/libraries/HtmlTextView/README.md
2013-09-09 13:16:54 +02:00

2.0 KiB

HtmlTextView for Android

This HtmlTextView supports all HTML tags supported by Android's Html class (see The CommonsBlog and history of Html class for newer additions). Additionally, list tags are supported (<ul>, <ol>, <dd>) and code tags with <code>.

This also includes a workaround to prevent TextView crashing on specific Android versions.

This library is kept very tiny with no external dependencies. I am using it to provide Help/About Activities in my apps.

Example

HtmlTextView text = new HtmlTextView(this);

// loads html from string
text.setHtmlFromString("<b>Hello</b><ul><li>world</li><li>cats</li></ul>");

or

HtmlTextView text = new HtmlTextView(this);

// loads html from raw resource, i.e., a html file in res/raw/, this allows translatable resource (e.g., res/raw-de/ for german)
text.setHtmlFromRawResource(this, R.raw.help);

Use library as Gradle dependency (Android library project)

  1. Copy this folder to your project and include it in settings.gradle with include ':html-textview'
  2. Add dependency compile project(':html-textview') to your project's build.gradle.

License

Apache License v2

Authors

Contributions

Feel free to fork and do pull requests. I am more than happy to merge them. Please do not introduce external dependencies.