简体   繁体   中英

What the best way to display html in the recyclerView?

In the recyclerView I display comments. Comments are stored as HTML.

I tried to display the comments in webView - all displayed well (with the ability to use custom *.css) but recyclerView significantly retarding while scrolling. And I was not able to make it "transparent" to the touch, because commentView support ripple effect (android:background="?attr/selectableItemBackground") but webView - no.

Also I tried to display the comments in textView as spannable. Everything works fast but much more difficult to customize the appearance.

Help me to choose the best way to display the comments in recyclerView.

As a result I want to get something like this:

在此输入图像描述

这里htmlString将为您提供html内容。

TextView textView = (TextView)findViewById(R.id.tv_string); textView.setText(Html.fromHtml(htmlString));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM