如何在包裹线的开头有固定的间距

时间:2018-05-05 18:20:31

标签: android

目前,我有以下用户界面

enter image description here

我对结果还不是特别满意。而不是

[x] Go to school on
Monday and grab
some sandwich

我希望它看起来像

[x] Go to school on
    Monday and grab
    some sandwich

应该是Google Keep

中的内容

enter image description here

现在,我通过以下代码实现了当前的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");
}

我可以知道,如何在包裹线的开头设置固定间距?

0 个答案:

没有答案