[英]Can't find where the preview window is in Android Studio 4.0(Canary)
I'm going through the tutorials about Jetpack which is ran in the Android Studio 4.0(Canary), please refer to the link post below.我正在阅读有关在 Android Studio 4.0(Canary) 中运行的 Jetpack 的教程,请参阅下面的链接帖子。
https://developer.android.com/jetpack/compose/tutorial https://developer.android.com/jetpack/compose/tutorial
Everything is ready except I can't find the preview window since I try to preview the "Composable" method.一切都准备好了,除了我找不到预览 window 因为我尝试预览“可组合”方法。
Can someone give me an exact hint that where the preview window is?有人可以给我一个确切的提示,预览 window 在哪里?
Check the official site :查看官方网站:
Beginning with Android Studio 4.0 Canary 1, Android Studio lets you preview your composable functions within the IDE, instead of needing to download the app to an Android device or emulator. Beginning with Android Studio 4.0 Canary 1, Android Studio lets you preview your composable functions within the IDE, instead of needing to download the app to an Android device or emulator. The main restriction is, the composable function must not take any parameters.主要限制是,可组合的 function 不能带任何参数。 Add the
@Preview
annotation before@Composable
.在@Composable
之前添加@Preview
注释。
Then select on the top-right the Editor and Preview toggle.然后 select 在右上角的编辑器和预览切换。
To update the preview click the Build Refresh button.要更新预览,请单击Build Refresh按钮。
You have to build the project first (Build -> Make Project).您必须先构建项目(构建 -> 制作项目)。 I also had to restart Android Studio in order for previews to start working.我还必须重新启动 Android Studio 才能开始预览。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.