mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-06 17:25:05 -05:00
2.0 KiB
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)
- Copy this folder to your project and include it in
settings.gradle
withinclude ':html-textview'
- Add dependency
compile project(':html-textview')
to your project'sbuild.gradle
.
License
Apache License v2
Authors
- This library was hacked together by Dominik Schürmann
- Original TagHandler developed by Mohammed Lakkadshaw
- Original UrlImageGetter developed by Antarix Tandon
- JellyBeanSpanFixTextView (with fix from comment) developed by Pierre-Yves Ricau
Contributions
Feel free to fork and do pull requests. I am more than happy to merge them. Please do not introduce external dependencies.