小编Kis*_*ani的帖子

android中VideoView和TextureView以及Suraceview有什么区别?

android中VideoView和TextureView以及Suraceview有什么区别?

我什么时候使用每一个?

android surfaceview textureview android-videoview

5
推荐指数
1
解决办法
2113
查看次数

Android Jetpack Compose - 图像无法缩放到框的宽度和高度

创建了 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)

android image android-jetpack android-jetpack-compose

5
推荐指数
2
解决办法
2135
查看次数

如何从包含Android中绝对文件路径的字符串中获取文件夹名称?

路径名是: /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)

/sf/answers/1859922501/

现在,我想从此路径中提取路径[/ storage / emulated / 0 / Xender / video]。

我在代码中使用了此路径,因此我想这样做。

我怎样才能做到这一点?

任何帮助将不胜感激。

java filenames android

2
推荐指数
1
解决办法
4553
查看次数