I want to add a custom view (a view with both text and icon) at the end of dynamic TextView like in this picture.
Thanks in advance.

It is possible programmatically:
fun TextView.setIconifiedText(text: String, @DrawableRes iconResId: Int) {
SpannableStringBuilder("$text#").apply {
setSpan(
ImageSpan(context, iconResId, DynamicDrawableSpan.ALIGN_BOTTOM),
text.length,
text.length + 1,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
}.let {
setText(it)
}
}
textView.setIconifiedText(
"First line text that is longer.\nSecond line text.",
R.drawable.ic_android_black_24dp
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With