我正在尝试将项目符号添加到unordered
列表中,BulletSpan.
但是,我在列表中找不到项目符号。下面是我的代码:
private static String appendBullet(int leadingMargin, String liText) {
SpannableString spannableString = new SpannableString(liText);
spannableString.setSpan(new BulletSpan(leadingMargin), 0, liText.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
Log.d("Ul tags", String.valueOf(spannableString));
return spannableString.toString();
}
这liItext
是列表项。我在BulletSpan
这里添加一个,然后返回该项目并将其添加到list
,最后将整个列表添加到StringBuilder
.
liList.add(appendBullet(15, liText));
List<String> liList = addListWithBullets(lists, new ArrayList<String>());
if (liList.size() > 0) {
for (String str : liList) {
builder.append(str);
builder.append("<br/>");
}
Log.d("Ul tags", String.valueOf(liList));
}