显示文字的最基本方法是使用以 String
作为参数的 Text
可组合项:
@Composable fun SimpleText() { Text("Hello World") }
显示资源中的文字
我们建议您使用字符串资源,而不是对 Text
值进行硬编码,因为使用字符串资源时您可以与 Android 视图共享相同的字符串,并为您的应用国际化做好准备:
@Composable fun StringResourceText() { Text(stringResource(R.string.hello_world)) }
目前没有任何推荐文档页面。
请尝试登录您的 Google 账号。