I have a textView
with text let's say
• I am asking a question from
stackoverflow
How can I make my textView
show it like
• 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());
I have done it like this...
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...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.