Open SkyGanfor opened 5 years ago
I am having a similar issue. The HtmlText does not allow for duplicateParentState=True attribute so allow for clickable
I have the same problem. It's due to setMovementMethod(..)
being called in setHtml(..)
in source code. If I got it right this call makes every HtmlTextView you use clickable by default therefore makes it intercept click events.
public void setHtml(@NonNull String html, @Nullable Html.ImageGetter imageGetter) {
final HtmlTagHandler htmlTagHandler = new HtmlTagHandler(getPaint());
htmlTagHandler.setClickableTableSpan(clickableTableSpan);
htmlTagHandler.setDrawTableLinkSpan(drawTableLinkSpan);
htmlTagHandler.setListIndentPx(indent);
html = htmlTagHandler.overrideTags(html);
if (removeTrailingWhiteSpace) {
setText(removeHtmlBottomPadding(Html.fromHtml(html, imageGetter, htmlTagHandler)));
} else {
setText(Html.fromHtml(html, imageGetter, htmlTagHandler));
}
// make links work
setMovementMethod(LocalLinkMovementMethod.getInstance());
}
Solution was to use setMovementMethod(null);
after setHtml()
.
You must disable forcus cardview, set setOnTouchListener in htmlTextView with call onTouchEvent of CardView
htmlTextView.setOnTouchListener((v, event) -> {
itemView.findViewById(R.id.layout_child).onTouchEvent(event);
return false;
});
I have a simple cardview that contains a htmltextview. But upon compiling, I'm not able to click the cardview and the htmltextview is in focus instead. I tried defining the htmltextview as not clickable or focusable, but to no success. Is there a way to click a cardview that contains the htmltextview? (htmltextview matches cardviews width and height).