0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

インデントをつける

Last updated at Posted at 2019-05-01
MainActivity.kt
        textView = findViewById<WrapTextView>(R.id.textView)
        val text = "あいうえお かきくけこ さし\nすせそ たちつてと なにぬねの はひふへほ まみ\nむめも やいゆえよ ら\n\nりるれろ わいうえを ん あいうえお \nかきくけこ さしすせそ たちつてと なにぬねの はひふへほ まみむめも やいゆえよ らりるれろ わいうえを ん あいうえお かきくけこ さしすせそ たちつてと なにぬねの はひふへほ まみむめも やいゆえよ らりるれろ わいうえを ん あいうえお かきくけこ さしすせそ たちつてと なにぬねの はひふへほ まみむめも やいゆえよ らりるれろ わいうえを ん あいうえお かきくけこ さしすせそ たちつてと なにぬねの はひふへほ まみむめも やいゆえよ らりるれろ わいうえを ん あいうえお かきくけこ さしすせそ たちつてと なにぬねの はひふへほ まみむめも やいゆえよ らりるれろ わいうえを ん"
        val textList = text.split("\n\n")
        val spannableStringBuilder = SpannableStringBuilder()
        textList.forEachIndexed { indexed, text ->
            val spannableString = SpannableString(text).apply { setSpan(BulletSpan(), 0, text.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) }
            spannableStringBuilder.append(spannableString)
            if (indexed < textList.size - 1) spannableStringBuilder.append("\n")
        }
        textView?.text = spannableStringBuilder

Screenshot_1.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?