I have used as below mentioned in my apps.
string.xml
<string name="about_fragment_privacy_policy" translatable="false">User Agreement and Privacy Policy</string>
Layout.xml
<TextView
    android:id="@+id/privacyPolicy"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/about_fragment_privacy_policy" />
Kotlin code
string = getString(R.string.about_fragment_privacy_policy)
spannableString = SpannableString(string)
val clickableUserAgreement = object : ClickableSpan() {
    override fun onClick(widget: View) {
        startActivity(
            Intent(Intent.ACTION_VIEW).setData(
                Uri.parse(
                    "https://example.com"
                )
            )
        )
    }
}
val clickablePrivacyPolicy = object : ClickableSpan() {
    override fun onClick(widget: View) {
        startActivity(
            Intent(Intent.ACTION_VIEW).setData(
                Uri.parse(
                    "https://example.com"
                )
            )
        )
    }
}
spannableString.setSpan(
    clickableUserAgreement,
    0,
    14,
    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
spannableString.setSpan(
    ForegroundColorSpan(resources.getColor(R.color.colorPrimary)),
    0,
    14,
    0
)
spannableString.setSpan(
    clickablePrivacyPolicy,
    19,
    string.length,
    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
spannableString.setSpan(
    ForegroundColorSpan(resources.getColor(R.color.colorPrimary)),
    19,
    string.length,
    0
)
privacyPolicy.text = spannableString
privacyPolicy.movementMethod = LinkMovementMethod.getInstance()