I want to setText
with Divider a conversation based on the tag in the adapter like a photo
What should I do?
Asked
Active
Viewed 31 times
0
![](../../users/profiles/10416954.webp)
parisa
- 1
- 2
-
that underline you want – Amit pandey Mar 17 '20 at 07:36
1 Answers
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:
![](../../users/profiles/959086.webp)
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