Here's some code from my TextView
subclass for handling bullets, I left out the easy part.
@Override
public void setText(CharSequence text, BufferType type) {
StringBuilder sb = new StringBuilder();
List<Integer> markers = new ArrayList<Integer>();
/*
* Code to parse through text, remove tags, build up modified text in
* StringBuilder and mark the bullet paragraph boundaries goes here.
* Left as an exercise for the reader.
*/
SpannableString spannableString = new SpannableString(sb.toString());
for (int i = 0; i < markers.size(); i += 2) {
int start = markers.get(i);
int end = markers.get(i+1);
spannableString.setSpan(new BulletSpan(bulletGap), start, end, Spannable.SPAN_PARAGRAPH);
}
super.setText(spannableString, BufferType.SPANNABLE);
}
Note: If I remember correctly, Android really really wants that Paragraph Span to end with a newline character.
Also I tried but couldn't figure out how to use LineHeightSpan
to make the first and last lines of the bullet span paragraph a little higher.
If you want a number (ordered) list, you're on your own.