Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Seems like an old question, I am having the same problem, What I did is overriding the default <strong>TagHandler</strong> , I am new to StackOverflow and Android, and appreciate any correction or a better method :) This one worked for me.</p> <pre><code>package com.tumblr.amangautam.cars; import org.xml.sax.XMLReader; import android.app.Activity; import android.os.Bundle; import android.text.Editable; import android.text.Html; import android.text.Html.TagHandler; import android.util.Log; public class MyTagHandler implements TagHandler{ boolean first= true; String parent=null; int index=1; @Override public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader) { if(tag.equals("ul")) parent="ul"; else if(tag.equals("ol")) parent="ol"; if(tag.equals("li")){ if(parent.equals("ul")){ if(first){ output.append("\n\t•"); first= false; }else{ first = true; } } else{ if(first){ output.append("\n\t"+index+". "); first= false; index++; }else{ first = true; } } } } } </code></pre> <p>and for displaying the text...</p> <pre><code>myTextView.setText(Html.fromHtml("&lt;ul&gt;&lt;li&gt;I am an Android developer&lt;/li&gt;&lt;li&gt;Another Item&lt;/li&gt;&lt;/ul&gt;", null, new MyTagHandler())); </code></pre> <p>[Edit]</p> <p>Kuitsi has also posted an really <a href="https://bitbucket.org/Kuitsi/android-textview-html-list" rel="noreferrer">good library</a> that does the same:</p> <p>Got it from <a href="https://stackoverflow.com/a/17365740/1234007">this SO link</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload