This repository was archived by the owner on Sep 7, 2020. It is now read-only.
Add setRemoveFromHtmlSpace function/ cleanup example #37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds the option of having HtmlTextView automatically trim the extra "space" that
Html.fromHtml
sometimes adds to the bottom of text, via a simplesetRemoveFromHtmlSpace(boolean)
method.setRemoveFromHtmlSpace
must be called before setting text for the trailing space to be trimmed off it there are any, it will not work after text is already set since it just simply sets a value that will causeremoveHtmlBottomPadding
to be used insetHtmlFromString
in theHtmlTextView
class.I like this approach more than a constructor because it's explicitly optional, straight forward, and not a breaking change, of-course a constructor could be added, w/ potentialy XML attributes so that it can be used from resources, but for now I don't think it's necessary.
I've also cleaned up
MainActivity
in the example app, moved the example html to a string resource, and addedsetRemoveFromHtmlSpace
as an example. Theactivity_main
layout now also has a slightly darker background from theHtmlTextView
so that you can clearly see the bounds w/o using developer options "show layout bounds"