小编ame*_*ter的帖子

设备上的文件系统处于错误状态。WorkManager 无法访问应用程序的内部数据存储

当我将工作管理器库添加到 android studio 并运行该应用程序时,它崩溃并出现以下错误:

E/SQLiteLog: (14) cannot open file at line 37816 of [c255889bd9]
    (14) os_unix.c:37816: (13) lstat(/data/user/0/com.example/no_backup/androidx.work.workdb) - 
    (1) Process m.example : Pid (13632) Uid (11395) Euid (11395) Gid (11395) Egid (11395)
    (1) osStat failed "/data/user/0/com.example/no_backup/androidx.work.workdb" due to error (13)
    (1) osStat failed "/data/user/0/com.first.academy/no_backup" due to error (13)
    (1) Stat of /data/user/0/com.example : st_mode(40700) st_uid(11385) st_gid(11385) st_ino(164253)
    (1) Stat of /data/user/0 : st_mode(40771) st_uid(1000) st_gid(1000) st_ino(131074)
    (1) Stat of /data/user : st_mode(40711) st_uid(1000) st_gid(1000) st_ino(655366)
    (1) Stat of /data …
Run Code Online (Sandbox Code Playgroud)

android android-workmanager

14
推荐指数
1
解决办法
8823
查看次数

如何在jetpack compose中使表面背景半透明,但内容不透明?

我想实现这种布局:

在此处输入图片说明

在 XML 中,我会在具有 match_parent 属性的相对布局中添加一个图像,然后是一个黑色半透明背景设置为 match_parent 的视图,然后是内容。

在 compose 中,我使这个变得可组合:

@Composable
fun ImageCover(resourceId: Int, alpha: Float = 0.5f, content: @Composable () -> Unit) {
    Box(modifier = Modifier.fillMaxSize()) {
        Image(
            painter = painterResource(id = resourceId),
            contentDescription = null,
            modifier = Modifier.fillMaxSize(),
            contentScale = ContentScale.Crop
        )
        Surface(
            color = Color.Black, modifier = Modifier
                .fillMaxSize()
                .alpha(alpha)
        ) {
            content()
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

但问题是 alpha 应用于表面及其内容。所以无论我放什么内容,即使是另一个有背景的表面,也会半透明。例如,在这里,底部的两个句子和两个组件也将是半透明的。

android android-jetpack-compose

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

如何在android中使用材料设计制作多色不确定线性进度指示器?

我想实现一个类似于这样的进度条:

在此处输入图片说明

在材料的设计文档,它说我需要设置indeterminateAnimationTypecontiguous实现这一目标,并提供三种颜色。但是当indicatorColor属性只接受一种颜色时如何提供三种颜色?

当我运行这段代码时,它抛出一个异常说Contiguous indeterminate animation must be used with 3 or more indicator colors

<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
app:indeterminateAnimationType="contiguous"
app:hideAnimationBehavior="outward"
app:showAnimationBehavior="inward"
app:trackThickness="5dp" />
Run Code Online (Sandbox Code Playgroud)

xml android android-progressbar material-design material-components-android

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