appendBulletSpans(...)
which takes the difficulty away from creating a bulleted list.You can use this extension function as follows:
val spannableStringBuilder = SpannableStringBuilder()
spannableStringBuilder.append("Here is a list of fruits:")
spannableStringBuilder.appendBulletSpans(
paragraphs = arrayOf("apple", "banana", "carrot"),
putVerticalSpaceBeforeFirstParagraph = true,
verticalSpaceToPutBetweenParagraphs = verticalSpaceInPixels,
horizontalSpaceToPutBetweenBulletPointAndParagraph = horizontalSpaceInPixels,
bulletPointColor = Color.BLACK
)
textView.text = spannableStringBuilder
This will render the text in a TextView as follows:You can find the source code for this extension function in the SpannableStringBuilderExtensions.kt file in this repository.