01. Compose 可组合组件之Row And Column
02. Compose 可组合组件之 属性 modifier
03. Compose 可组合组件之Card 图片
04. Compose字体
class FontActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
//创建字体
val fontFamily = FontFamily(
Font(R.font.opensans_bold, FontWeight.Bold),
Font(R.font.opensans_light, FontWeight.Thin),
Font(R.font.opensans_semibold, FontWeight.Normal),
)
setContent {
Box(
modifier = Modifier
.fillMaxSize()
.background(Color(0xFF101010))
) {
Text(
// text = "Android Jetpack Compose",
text = buildAnnotatedString {
withStyle(
style = SpanStyle(
color = Color.Red,
fontSize = 24.sp
)
) {
append("A")
}
append("ndroid ")
withStyle(
style = SpanStyle(
color = Color.Red,
fontSize = 24.sp
)
) {
append("J")
}
append("etpack ")
withStyle(
style = SpanStyle(
color = Color.Red,
fontSize = 24.sp
)
) {
append("C")
}
append("ompose")
},
color = Color.White,
fontSize = 20.sp,
fontFamily = fontFamily,
fontWeight = FontWeight.Bold,
// fontStyle = FontStyle.Italic,
textAlign = TextAlign.Center,
// textDecoration = TextDecoration.LineThrough,
// textDecoration = TextDecoration.Underline,
)
}
}
}
}