无法导入 androidx.compose.ui.platform.DensityAmbient (DensityAmbient)
Cannot import androidx.compose.ui.platform.DensityAmbient (DensityAmbient)
我正在尝试导入 androidx.compose.ui.platform.DensityAmbient
我不能。 DensityAmbient 是红色的,似乎 class 不存在。
这是我的 gradle:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.6.21"
implementation 'androidx.core:core-ktx:1.7.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.material:material-ripple:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
implementation 'androidx.activity:activity-compose:1.4.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
}
有没有人知道(也许版本不匹配)?
此包中不存在此 class
查看文档:
https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/package-summary
尝试使用 LocalDensity 参见:Jetpack Compose Density
我正在尝试导入 androidx.compose.ui.platform.DensityAmbient
我不能。 DensityAmbient 是红色的,似乎 class 不存在。
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.6.21"
implementation 'androidx.core:core-ktx:1.7.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.material:material-ripple:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
implementation 'androidx.activity:activity-compose:1.4.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
}
有没有人知道(也许版本不匹配)?
此包中不存在此 class
查看文档:
https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/package-summary
尝试使用 LocalDensity 参见:Jetpack Compose Density