当前位置:网站首页>Kotlin compose text supports two colors
Kotlin compose text supports two colors
2022-07-07 04:15:00 【Ango can't move】
First, you can use native to render html
@Composable
fun TitleByYellow(
textAll: String,
textYellow: String? = null,
textSizeSp: Float = 15F,
@ColorRes textColorRes: Int = R.color.color_4A4A4A,
isBold: Boolean = false
) {
var text = textAll
if (!TextUtils.isEmpty(textYellow)) {
text = textAll.format("<font color='#F6CA2D'>$textYellow</font>")
}
val htmlDescription = Html.fromHtml(text)
AndroidView(factory = { context ->
val tv = TextView(context)
tv.apply {
textSize = textSizeSp
setTextColor(context.getColor(textColorRes))
if (isBold) {
setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
}
}
tv
},
update = {
it.text = htmlDescription
}
)
}边栏推荐
- Restore backup data on GCS with tidb lightning
- Do you choose pandas or SQL for the top 1 of data analysis in your mind?
- OSCP工具之一: dirsearch用法大全
- Opencv third party Library
- Kotlin Android environment construction
- SSM+JSP实现企业管理系统(OA管理系统源码+数据库+文档+PPT)
- Unity3D在一建筑GL材料可以改变颜色和显示样本
- Termux set up the computer to connect to the mobile phone. (knock the command quickly), mobile phone termux port 8022
- 二叉搜索树的实现
- 中青杯2022A题高校数学建模竞赛与课程教育思路分析
猜你喜欢
![[coded font series] opendyslexic font](/img/5e/e1512ffe494b5d0e7d6d6765644126.png)
[coded font series] opendyslexic font
Implementation steps of docker deploying mysql8

【ArcGIS教程】专题图制作-人口密度分布图——人口密度分析

Force buckle ----- path sum III

运算放大器应用汇总1

The most complete deployment of mongodb in history

DAB-DETR: DYNAMIC ANCHOR BOXES ARE BETTER QUERIES FOR DETR翻译

Mysql-数据丢失,分析binlog日志文件

ABAP dynamic inner table grouping cycle

Collection of idea gradle Lombok errors
随机推荐
vim —- 自己主动的按钮indent该命令「建议收藏」
Preprocessing - interpolation
Web service performance monitoring scheme
[written to the person who first published the paper] common problems in writing comprehensive scientific and Technological Papers
Redis源码学习(30),字典学习,dict.h
Golang calculates constellations and signs based on birthdays
Kotlin Compose Text支持两种颜色
手机号国际区号JSON格式另附PHP获取
2022中青杯C题城市交通思路分析
tflite模型转换和量化
【OA】Excel 文档生成器: Openpyxl 模块
Analysis on the thinking of college mathematical modeling competition and curriculum education of the 2022a question of the China Youth Cup
DAB-DETR: DYNAMIC ANCHOR BOXES ARE BETTER QUERIES FOR DETR翻译
使用 BR 恢复 GCS 上的备份数据
史上最全MongoDB之Mongo Shell使用
力扣------路径总和 III
你心目中的数据分析 Top 1 选 Pandas 还是选 SQL?
idea gradle lombok 报错集锦
科兴与香港大学临床试验中心研究团队和香港港怡医院合作,在中国香港启动奥密克戎特异性灭活疫苗加强剂临床试验
ERROR: Could not build wheels for pycocotools which use PEP 517 and cannot be installed directly