0

enter image description here

I want to setText with Divider a conversation based on the tag in the adapter like a photo What should I do?

parisa
  • 1
  • 2

1 Answers1

0

You can use something like this:

public static Spanned fromHtml(String source) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        return Html.fromHtml(source, Html.FROM_HTML_MODE_LEGACY);
    } else {
        return Html.fromHtml(source);
    }
}

...

textView.setText(fromHtml("Some text <b>Bold</b>"));

More info:

Kenumir
  • 600
  • 4
  • 20
  • how set divider like that in item adapter? String[] separatedText = chat_content.split("
    "); for (int i = 0; i < separatedText.length; i++) { viewHolder_conversation.txtChat_conversation.setText(fromHtml(chat_content)); if (i == separatedText.length - 1) viewHolder_conversation.divider.setVisibility(View.GONE); else viewHolder_conversation.divider.setVisibility(View.VISIBLE); }
    – parisa Mar 17 '20 at 07:46
  • Dividers may be set in this way https://stackoverflow.com/a/27037230/959086 – Kenumir Mar 17 '20 at 10:16