Quantcast
Channel: Is it possibile to use extension functions in databinding? - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Anu for Is it possibile to use extension functions in databinding?

$
0
0

I did it using binding adapter

 @BindingAdapter("app:text")@JvmStaticfun htmlText(view: TextView, text: String?) {    text?.let {        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {            view.text = Html.fromHtml(it.trim(), Html.FROM_HTML_MODE_COMPACT)        } else {            view.text = Html.fromHtml(it.trim())        }    }}

like this.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>