android - 在 Android Studio 4.0(Canary) 中找不到预览窗口的位置

标签 android android-studio android-jetpack-compose android-studio-4.0

我正在阅读有关在 Android Studio 4.0(Canary) 中运行的 Jetpack 的教程,请参阅下面的链接帖子。

https://developer.android.com/jetpack/compose/tutorial

一切都准备好了,除了我找不到预览窗口,因为我尝试预览“可组合”方法。

有人可以给我一个确切的提示预览窗口在哪里吗?

最佳答案

查看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. The main restriction is, the composable function must not take any parameters. Add the @Preview annotation before @Composable.



然后选择右上角的编辑和预览 切换。

enter image description here

enter image description here

要更新预览,请单击 构建刷新 按钮。

enter image description here

关于android - 在 Android Studio 4.0(Canary) 中找不到预览窗口的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58621252/

相关文章:

android - Android Studio 上的 Code Iris 插件

android - Jetpack Compose,如何测试导航?

android - 为什么我无法从某些设备获取 HPROF 转储?

Android Studio build.gradle - 无法解析符号 'android'

android - Android和使用依赖项。可以吗就像在代码中使用别人的构建实现。

android - 如何更改 android compose TextField 的内容填充?

Android Jetpack 组合。使用堆栈布局

android - 使用 Material Components 和 androidX 编译 Android 应用程序时出错

android - 从应用程序的主要 Activity 调用小部件的 onUpdate 方法

android - 为什么在 Honeycomb 中引入的 API 可以在 Gingerbread 上运行?