2

我有一个textView文字让我们说

• I am asking a question from
stackoverflow

我怎样才能让我的textView节目像

• I am asking a question from
  stackoverflow




String facil = accomodation.facilities;
facil = facil.replace("<>", "%");
Spanned sp = Html.fromHtml(facil);
facil = sp.toString();

String[] items = facil.split("%");
CharSequence allFacil = "";

for (int i = 0; i < items.length; i++)
{
    String text = items[i];
    SpannableString s = new SpannableString("• " + text + "\n");
    s.setSpan(new BulletSpan(BulletSpan.STANDARD_GAP_WIDTH), 0, text.length(), 0);          
    allFacil = TextUtils.concat(allFacil, s);         
} 

facilities.setText(allFacil.toString());
4

1 回答 1

4

我已经这样做了......

String[] items = new String[] { "item 1", "item 2", "item 3" };
CharSequence allText = "";
for (int i = 0; i < items.length; i++)
{
    String text = items[i];
    SpannableString s = new SpannableString(text + "\n");
    s.setSpan(new BulletSpan(BulletSpan.STANDARD_GAP_WIDTH), 0, text.length(), 0);          
    allText = TextUtils.concat(allText, s);         
} 

...

public class BulletSpan implements LeadingMarginSpan...
于 2013-05-08T14:55:26.763 回答