简体   繁体   English

无法激活预览模式Android Studio

[英]Can't activate Preview mode Android Studio

I am trying to switch over to the new Android Studio (awesome btw) but I can' activate the "Preview" window to view my XML files like they demo'd in I/O. 我正在尝试切换到新的Android Studio(真棒btw),但我可以'激活“预览”窗口来查看我在I / O中演示的XML文件。

When I navigate to View-->Tool Windows-->Preview 'Preview' is greyed out and I can't select it. 当我导航到视图 - >工具窗口 - >预览'预览'时显示为灰色,我无法选择它。

Does anyone know a fix for this? 有谁知道解决这个问题?

I had the same problem. 我有同样的问题。 Then I chose a different device. 然后我选择了另一种设备。 I saw the error window with the ability to click "rebuild". 我看到了错误窗口,可以单击“重建”。 I clicked and it worked. 我点击它,它工作。

截图在这里

有同样的问题,这个解决方案适用于我File - Invalidate Caches / Restart

Studio 2.2.1 / Build #AI-143.2821654, April 28, 2016. Studio 2.2.1 / Build#AI-143.2821654,2016年4月28日。

Regarding: Missing the Preview Tab or grayed out Designer from View/Tool. 关于:缺少预览选项卡或从视图/工具中淡出设计器。

From the directory tree, click on the following directory to access activity_main.xml : 从目录树中,单击以下目录以访问activity_main.xml

app/src/main/res/layout/activity_main.xml

or (depending on your directory structure, actual location may vary) 或(取决于您的目录结构,实际位置可能会有所不同)

app/res/layout/activity_main.xml

Afterward, you should notice the Preview tab to the right. 之后,您应该注意到右侧的“ 预览”选项卡。

To access Designer. 访问Designer。 You'll be able to find the Design|Text tab below your code. 您将能够在代码下方找到“设计”|“文本”选项卡。

PS My problem was the Designer was grayed out. PS我的问题是设计师变灰了。 After the fix, the Designer from Menu bar/View/Tool Window/Designer is still grayed out. 修复后,菜单栏/视图/工具窗口/设计器中的Designer仍显示为灰色。 But you should be able to access the designer anyway. 但无论如何你应该能够访问设计师。

屏幕截图

What worked for me was changing the theme of the app. 对我有用的是改变应用程序的主题。

Sometimes, parameters like Theme, Device preview, etc, can affect the preview although it may look well in the app. 有时,主题,设备预览等参数会影响预览,尽管它在应用程序中可能看起来很好。

Changing these helps. 改变这些有帮助。 Can be accessed from design and text view. 可以从设计和文本视图访问。

就像设计视图中的这些Params一样

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM