android中VideoView和TextureView以及Suraceview有什么区别?
我什么时候使用每一个?
创建了 ImageCard 视图,用于在 android jetpack compose 中创建列表,但某些图像无法抓取到 Box 小部件的宽度和高度。
使用 640*427 图像并像图像 1 一样输出。
使用 6720*4480 图像,它看起来像图像 2。
使用下面的代码创建 ImageCard。
ImageCard 函数的用法:在 setContent{} 函数中调用 ImageCardData 函数
@Composable
fun ImageCard(
painter: Painter,
title: String,
contentDescription: String,
modifier: Modifier = Modifier
) {
Card(
modifier = modifier.fillMaxWidth(),
shape = RoundedCornerShape(10.dp),
elevation = 5.dp
) {
Box(
modifier = Modifier.height(200.dp)
) {
Image(
painter = painter,
contentDescription = contentDescription,
contentScale = ContentScale.Crop
)
Box(
modifier = Modifier
.fillMaxSize()
.background(
brush = Brush.verticalGradient(
colors …Run Code Online (Sandbox Code Playgroud) 路径名是: /storage/emulated/0/Xender/video/MyVideo.mp4
我可以使用以下命令从路径中获取最后一个文件名[MyVideo.mp4]
String path="/storage/emulated/0/Xender/video/MyVideo.mp4";
String filename=path.substring(path.lastIndexOf("/")+1);
Run Code Online (Sandbox Code Playgroud)
现在,我想从此路径中提取路径[/ storage / emulated / 0 / Xender / video]。
我在代码中使用了此路径,因此我想这样做。
我怎样才能做到这一点?
任何帮助将不胜感激。