目前,我有以下用户界面
我对结果还不是特别满意。而不是
[x] Go to school on
Monday and grab
some sandwich
我希望它看起来像
[x] Go to school on
Monday and grab
some sandwich
应该是Google Keep
中的内容现在,我通过以下代码实现了当前的UI效果。
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
for (Checklist uncheckedChecklist : uncheckedChecklists) {
spannableStringBuilder.append("\u2610 ").append(uncheckedChecklist.getText()).append("\n");
}
for (Checklist checkedChecklist : checkedChecklists) {
spannableStringBuilder.append("\u2611 ");
int start = spannableStringBuilder.length();
final String text = checkedChecklist.getText();
spannableStringBuilder.append(text);
StrikethroughSpan strikethroughSpan = new StrikethroughSpan();
spannableStringBuilder.setSpan(strikethroughSpan, start, start+text.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
spannableStringBuilder.append("\n");
}
我可以知道,如何在包裹线的开头设置固定间距?