I need help, i am stuck in this. My requirement is, I need to add text inside a tooltip. I did that actually. But the text include multiple line text also some lines having bold style other line having regular style with custom font style. By the below code which i am using, i can able to add bold, italic and regular style. But i need to add below custom font style into the text. Please have a look into my below code.
textViewToShow.setOnClickListener { view ->
val tfBold = Typeface.createFromAsset(
context!!.assets,
"fonts/myriad_pro_bold.ttf"
)
val tfRegular = Typeface.createFromAsset(
context!!.assets,
"fonts/myriad_pro_regular.ttf"
)
var string1 = “Item show in Bold style”
var string2 = “Item show in Regular style”
var string3 = “Item show in Regular style with item description”
val holesTextView = Html.fromHtml("<b>" + string1 + "</b> <br><br> <b><i>"+ string2 + "</i></b> " + string3)
showToolTip(view, holesTextView)
}
private fun showToolTip(view: View, holesTextView: Spanned) {
val builder: Tooltip.Builder =
Tooltip.Builder(view, R.style.Tooltip)
.setText(holesTextView)
builder.show()
}
Any solution/suggestions are highly appreciated