Android Compose - 无法使用 Modifier.align()

Pho*_*gBM 2 android android-jetpack-compose

我使用 Compose 版本 1.0.0-beta06,无法调用Modifier.align()方法

构建.gradle

    // Compose
    implementation 'androidx.compose.ui:ui:1.0.0-beta06'
    implementation 'androidx.compose.ui:ui-tooling:1.0.0-beta06'
    implementation 'androidx.compose.foundation:foundation:1.0.0-beta06'
    implementation 'androidx.compose.material:material:1.0.0-beta06'
    implementation 'androidx.compose.material:material-icons-core:1.0.0-beta06'
    implementation 'androidx.compose.material:material-icons-extended:1.0.0-beta06'
    implementation 'androidx.activity:activity-compose:1.3.0-alpha07'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha04'
    implementation 'androidx.compose.runtime:runtime-livedata:1.0.0-beta06'
    implementation 'androidx.compose.runtime:runtime-rxjava2:1.0.0-beta06'

    // Compose Accompanist
    implementation 'com.google.accompanist:accompanist-coil:0.9.1'
    implementation 'com.google.accompanist:accompanist-pager:0.9.1'
    implementation 'com.google.accompanist:accompanist-pager-indicators:0.9.1'
    implementation 'com.google.accompanist:accompanist-systemuicontroller:0.9.1'

    // Compose other libs
    implementation("androidx.compose.ui:ui-util:1.0.0-beta06")
Run Code Online (Sandbox Code Playgroud)

库包含此方法 图片-1

但是,我不能称之为 图片-2

请帮我。谢谢!

mus*_*ikk 6

align()方法是BoxScopeDSL 的一部分。为了使用该方法,您应该位于 a 内部,而不是像示例中那样Box位于 a 内部。Row