Text(text="Hi") 和 Text("Hi") 有什么区别?
如何制作 CustomText( text = "Hi")
class MainActivity : Base() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MaterialTheme {
Column {
Text(text = "Hi")
Text("Hi")
//CustomText(text = "Hi")
CustomText("Hi")
}
}
}
}
}
open class Base : AppCompatActivity() {
fun CustomText(inputString: String) {
Text(
inputString,
style = TextStyle(color = Color.Green, fontSize = 22.sp)
)
}
}