jac*_*ood 14 android kotlin android-jetpack android-jetpack-compose
如何在 Jetpack Compose 中使用 Android 的共享表共享内容?
Gab*_*tti 34
在 a 内部,@Composable您可以Intent以标准方式使用 an 。
就像是:
val sendIntent: Intent = Intent().apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_TEXT, "This is my text to send.")
type = "text/plain"
}
val shareIntent = Intent.createChooser(sendIntent, null)
val context = LocalContext.current
Button(onClick = {
context.startActivity(shareIntent)
}){
Text("Share")
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6112 次 |
| 最近记录: |