3

我能够在android中创建一个子弹跨度。这是我所取得的成就的快照

在此处输入图像描述

如何缩进以确保跨越多行的列表项不会与此快照中显示的项目符号在同一点开始?

在此处输入图像描述

这是我的代码

String description="";
        for (JsonElement e:sl.get("description").getAsJsonArray()){

            if(!e.getAsString().trim().isEmpty() && CharMatcher.javaUpperCase().or(CharMatcher.javaLetter().negate()).matchesAllOf(e.getAsString().trim())) {
                SpannableString s1 = new SpannableString(e.getAsString());
                s1.setSpan(new BulletSpan(20), 1, e.getAsString().length(), 0);
                description +=s1 + "\n\n";
            }else if(!e.getAsString().trim().isEmpty()) {
                    SpannableString s1 = new SpannableString(e.getAsString());
                s1.setSpan(new BulletSpan(20), 1, e.getAsString().length(), 0);

                description += "\u25CF " +"  "+ s1 + "\n\n";
            }
        }

        viewHolder.body.setText(description);
        viewHolder.body.setTypeface(tf);

这是xml

<me.biubiubiu.justifytext.library.JustifyTextView
            android:id="@+id/body"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="fill_vertical"
            android:layout_below="@+id/thumbnail"
            android:textColor="@color/black"
            android:textSize="16sp"/>
4

1 回答 1

1

LeadingMarginSpan在设置之前实施BulletSpan

s1.setSpan(new LeadingMarginSpan.Standard(30, 60), 1, s1.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
于 2019-01-15T02:34:08.710 回答