Can't find where the preview window is in Android Studio 4.0(Canary)

╄→尐↘猪︶ㄣ 提交于 2019-12-12 10:54:26

问题


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.

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.

Can someone give me an exact hint that where the preview window is?


回答1:


You have to build the project first (Build -> Make Project). I also had to restart Android Studio in order for previews to start working.




回答2:


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

Then select on the top-right the Editor and Preview toggle.

To update the preview click the Build Refresh button.



来源:https://stackoverflow.com/questions/58621252/cant-find-where-the-preview-window-is-in-android-studio-4-0canary

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!