I have a rich textview (I don't know the exact name of it but it shown in the image below) in admin control panel that allow the admin to write the description of product
and I have an api that return the code of this textbox and it return something like this for the above text:
<ul><li>Simple product with user role price activited</li><li>Without flavor and size<br></li></ul>
My question is how can I display this kind of rich text view code into text view in my apk
Edit: I tried to use fromHtml
method but it doesn't work, maybe because I have html tags like ul
and li
?
You can use WebView
to display your HTML data like this
val webView = findViewById<WebView>(R.id.my_webview)
val text = "<ul><li>Simple product with user role price activited</li><li>Without flavor and size<br></li></ul>"
webView.loadDataWithBaseURL(null, text, "text/html", "utf-8", null)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.