【问题标题】:What the best way to display html in the recyclerView?在 recyclerView 中显示 html 的最佳方式是什么?
【发布时间】:2016-06-17 18:07:21
【问题描述】:

在 recyclerView 我显示 cmets。注释存储为 HTML。

我尝试在 webView 中显示 cmets - 所有显示都很好(能够使用自定义 *.css),但 recyclerView 在滚动时显着延迟。而且我无法让它对触摸“透明”,因为 commentView 支持涟漪效应(android:background="?attr/selectableItemBackground")但 webView - 没有。

我还尝试将 textView 中的 cmets 显示为可扩展的。一切都运行得很快,但定制外观要困难得多。

帮助我选择在 recyclerView 中显示 cmets 的最佳方式。

因此我想得到这样的东西:

【问题讨论】:

    标签: android html css android-recyclerview spannable


    【解决方案1】:

    这里 htmlString 将保存您的 html 内容。

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

    【讨论】:

      猜你喜欢
      • 2010-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-04
      • 2011-04-10
      • 2015-08-12
      • 2010-10-19
      相关资源
      最近更新 更多