A
A
artshelom2018-01-27 12:12:08
Android
artshelom, 2018-01-27 12:12:08

Strikethrough text not working, how to fix it??

I show here such text:
<h1>КОД1 <s>КОД2</s></h1>
I load in textView:

TextView textView = new TextView(context);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            textView.setText(Html.fromHtml(text, FROM_HTML_SEPARATOR_LINE_BREAK_HEADING));
        }else{
            textView.setText(Html.fromHtml(text));
        }
        textView.setLinksClickable(true);
        textView.setTextColor(ContextCompat.getColor(context, R.color.post_text));
        textView.setMovementMethod(LinkMovementMethod.getInstance());

As a result, the text is bold (as h1 should be), but the text is not crossed out (( How to fix it??

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Zagaevsky, 2018-01-27
@artshelom

You can use Spannable , in particular StrikethroughSpan .

A
Alexey, 2018-01-27
@Azperin

<h1>КОД1 <del>КОД2</del></h1>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question