英文:
ModalBottomSheet in Material 3 for compose
问题
I have switched from Material 2 to Material 3 in my android compose project :
我已经将我的Android Compose项目从Material 2切换到Material 3:
I have this dependencie which is the latest stable one :
我有这个依赖项,它是最新的稳定版本:
implementation ("androidx.compose.material3:material3:1.0.1")
根据文档,我应该能够导入并使用ModalBottomSheet:
但是在导入时,我遇到了未解决的引用问题:
import androidx.compose.material3.ModalBottomSheet
All my others M3 components are fine.
我所有其他的M3组件都正常。
Can anyone help me on how I can import ModalBottomSheet without problem ?
英文:
I have switched from Material 2 to Material 3 in my android compose project :
I have this dependencie which is the latest stable one :
implementation ("androidx.compose.material3:material3:1.0.1")
As mention in the docs i should be able to import and use the ModalBottomSheet :
But i get unresolved reference when importing :
import androidx.compose.material3.ModalBottomSheet
All my others M3 components are fine.
Can anyone help me on how I can import ModalBottomSheet without problem ?
答案1
得分: 6
你需要使用Material 3的版本1.1.0-alpha06,因为这是一个非常新的添加。请查看发布说明此处。
英文:
You need to use Version 1.1.0-alpha06 of Material 3 as this is a very recent addition. Please have a look at the release notes here.
答案2
得分: 1
你需要在Gradle模块级别的文件中将compose-bom
更新到最新版本,如下所示:
implementation(platform("androidx.compose:compose-bom:2023.08.00"))
目前最新版本是2023.08.00
,随时可以根据需要进行更改。
英文:
You need to update the compose-bom to latest version in gradle module level file
like this:
implementation(platform("androidx.compose:compose-bom:2023.08.00"))
currently the latest version is 2023.08.00
when ever you want it change it according.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论