某些 XML 布局未显示 Android Studio 3.1 XML 预览 [英] Android studio 3.1 XML preview not showing for some XML layouts

查看:47
本文介绍了某些 XML 布局未显示 Android Studio 3.1 XML 预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显示了一些布局,有些只有空白的灰色框架.我似乎无法找到有效的 XML 布局与无效的 XML 布局之间的相关性,绑定、约束布局、复杂性和长度各不相同、无错误的混合使用.该应用程序正在编译和运行良好.

Some layouts are shown, some just have blank, gray frame. I can't seem to find a correlation between XML layouts that work and those that do not, there is a mixture of use of binding, constraint layout, varied in complexity and length, error-free. The app is compiling and running well.

有什么建议吗?

清除缓存/重启、清理、重建对此没有影响

Clearing cache/restarting, cleaning, rebuilding had no effect on this

解决方案:在预览模式下注意到布局旁边有一个红色错误图标.它与 id 资源解析器 @1 有关.我手动编辑了布局上的资源 ID 之一.这以某种方式解决了其余布局的问题.奇怪的.

Solution: Noticed a red error icon next to layout in preview mode. It had something to do with id resources resolver @1 . I manually edited one of resource ids on a layout. This somehow fixed issue with rest of the layouts. Weird.

编辑:问题似乎一直在重复发生.然而,在预览中更改主题确实有帮助.如果您遇到问题,我也会尝试将预览模式更改为蓝图.

Edit: It seems that problem keeps reoccurring. Changing theme on the preview does however help. I would also try to change preview mode to blueprint if you are having problems.

编辑 2:我使用了 Android Studio 3.2 Canary 9,布局按预期工作,没有问题.我猜它与新旧绑定编译器有关

Edit 2: I've went with Android Studio 3.2 Canary 9 and layouts are working as expected without problems. I'm guessing it had something to do with new-old bindings compiler

编辑 3:天哪……问题还没有结束.3.2 Canary 11 在编辑布局时快速用完所有给定的内存,然后 GC 对我来说一直落后于所有 IDE.需要每 30 分钟重启一次 IDE.我最终恢复到 3.1.1,如果没有加载内容,我会按照下面评论中的建议强制刷新布局.

Edit 3: Oh god... problems are not ending. 3.2 Canary 11 uses up all given memory fast while editing layouts and then GC keeps lagging all IDE for me. Need to restart IDE every 30mins. I end up reverting to 3.1.1 and if things are not loading I force refresh layout as it was suggested in below comment.

推荐答案

对我来说,只有强制刷新布局"有效.重新启动、重新构建、清理都没有用.

For me, only "Force Refresh Layout" worked. Restarting, re-building, cleaning didn't work.

这篇关于某些 XML 布局未显示 Android Studio 3.1 XML 预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆