devendroid / ReadMoreOption

Convert your TextView in ExpandableTextView with added options ReadMore/ReadLess.
Apache License 2.0
207 stars 38 forks source link

it can support Html? #4

Closed 012ABC closed 6 years ago

012ABC commented 6 years ago

String string= "

【多地公布蓝天保卫战具体行动计划】记者4日从生态环境部了解到,近日多个省市公布蓝天保卫战相关计划和具体实施方案。国务院此前印发《打赢蓝天保卫战三年行动计划》,明确了大气污染防治工作的总体思路、基本目标、主要任务和保障措施,提出了打赢蓝天保卫战的时间表和路线图。随后,各地结合当地实际情况,加紧制定和发布地方具体计划和实施目标。查看源码应该只支持这几种,不过看最后一句代码发现它是支持自定义标签处理的,就是说你可以自己重写TagHandler去实现。" + "结合前面说的SpannableString和参考的Html类源码可以实现我们这篇文章的需求,如果你只是想解析HTML在TextView的上显示不同的颜色,那系统已经实现了,但前提是要用的字体标签。经济参考报)

";

textView.setText(Html.from(string)); but it can't support

devendroid commented 6 years ago

Use like -

ReadMoreOption readMoreOption = new ReadMoreOption.Builder(this).build();
readMoreOption.addReadMoreTo(textView, Html.fromHtml(string).toString());
alirezat66 commented 5 years ago

@devendroid this does not work exactly because for using tag or colors your library not work with this code. could you please me to solve this problem