j'ai données JSON comme celui-cichaîne HTML n'est pas le rendu dans textview
{
"user_id": "27",
"notification": "<a>There is package wiating for you to pick from <font style="color: blue;"> #Surat</font> to <font style = "color: blue;"> #Adajan, Surat, Gujarat, India</font> </a>",
},
{
"user_id": "27",
"notification": "<a>There is package wiating for you to pick from <font style="color: blue;"> #majuraget, surat</font> to <font style = "color: blue;"> #pal, surat</font> </a>",
},
{
"user_id": "27",
"notification": "<a>There is package wiating for you to pick from <font style="color: blue;"> #majuraget, surat</font> to <font style = "color: blue;"> #pal, surat</font> </a>",
},
{
"user_id": "27",
"notification": "<a>There is package wiating for you to pick from <font style="color: blue;"> #majuraget, surat</font> to <font style = "color: blue;"> #pal, surat</font> </a>",
}
i m rendu cette chaîne de notification Textview mais sa ne fonctionne pas.
c'est ce que j'ai essayé
Spanned value = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
value = Html.fromHtml(notifications.getTitle(), Html.FROM_HTML_MODE_COMPACT);
holder.txtTitle.setMovementMethod(LinkMovementMethod.getInstance());
holder.txtTitle.setText(value);
}else {
value = Html.fromHtml(notifications.getTitle());
holder.txtTitle.setMovementMethod(LinkMovementMethod.getInstance());
holder.txtTitle.setText(value);
}
j'ai essayé aussi ce library:
Spanned fromHtml = HtmlCompat.fromHtml(context, notifications.getTitle(), 0);
holder.txtTitle.setMovementMethod(LinkMovementMethod.getInstance());
holder.txtTitle.setText(fromHtml);
mais rien de tout cela est le travail.
ce que je reçois en sortie:
et ce que je pense
Avez-vous essayé ce https://stackoverflow.co m/questions/42389878/android-app-pas-rendu-html-tags-très-bien – Ankita