1、想要获取系统内部的内置软件的一些内容,就需要文件选择器(写的不是很对)
Column {
imageUri?.let {
Image(
painter = rememberAsyncImagePainter(model = imageUri),
contentDescription = null,
modifier = Modifier
.clip(CircleShape)
.size(120.dp)
)
}
var imageUri by remember {
mutableStateOf<Uri?>(null)
}
val galleryLauncher =rememberLauncherForActivityResult(
contract = ActivityResultContracts.GetContent()
) { it ->
it?.let { it1 ->
imageUri = it
}
}
Log.d("eee", text)
}
2、为什么要用uri,因为通过文件选择器获得的内容返回的值都是uri,并不是它真实的地址,所以需要通过它内部自己进行转换