简体   繁体   English

如何从数据库android在recyclerview中显示html.fromhtml文本

[英]how to show html.fromhtml text in recyclerview from database android

I am able to save and retrieve the rich text (bold, italic, color) to and from the database into the editor. 我能够保存富文本(粗体,斜体,彩色),并将其从数据库中检索出来并从中检索到编辑器中。 But when I try to show the rich text in the recyclerview, it shows me only plain text and not the styled text (color, bold etc). 但是,当我尝试在recyclerview中显示富文本时,它仅显示纯文本,而不显示带样式的文本(颜色,粗体等)。 How can I do this? 我怎样才能做到这一点? Thanks 谢谢

Showing text in the recyclerview 在recyclerview中显示文本

String texto_sin_html = Html.fromHtml(list.get(position).getTexto()).toString();
    holder.texto.setText(texto_sin_html);

saving text to database 将文本保存到数据库

String almostSameText = Html.toHtml(texto.getEditableText()).toString();
                    base.modificarNota(titulo.getText().toString().trim(), almostSameText, id);
                    getActivity().onBackPressed();

It should be; 它应该是;

holder.texto.setText(Html.fromHtml(list.get(position).getTexto())); 

without the toString() 没有toString()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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