Add Colors to your TextView There is a small trick behind this. You have to Keep the text value of textView Empty. Because the string will be written in java part this time. Here Goes the entire code for this: MainActivity.java package com.androiddevelopmentguru.spannable; import android.R.color; import android.os.Bundle; import android.app.Activity; import android.graphics.Color; import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.style.ForegroundColorSpan;
Learn Android tutorial Android Basics in Kotlin, Advanced Kotlin, Kotlin Fundamentals, Android Developer Fundamentals (Java)