[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
背景:
在AndroidStudio中,经常会出现布局创建出来或者一个已存在的布局打开无法预览,design或者split都没有效果
有人说是因为主题导致的。其实有部分是因为主题,在原来的主题parent的前面加一个Base,变成Base.Theme.Light等。但是大多数是无法解决的。
但是在出现initializing或者loading是无法解决,最好的办法就是删除
项目的配置信息和gradle的配置文件。因为idea和gradle如果出现异常就到导致布局无法预览。
删除这两个文件,我们需要重新启动开发工具
重新打开,整个项目的历史缓存和设置都没了。又变成一个干净的项目,这样等相处初始化完毕,损坏的文件已被换成新的,布局正常是可以加载出来了
删除->file-> restart ,只要出现就按这个步骤操作
备注:如果你的布局通过该方法可以显示,但是打开另一个项目,新项目无法显示,会引起其他项目也会出现无法预览,这个时候还是按以上步骤操作即可。有些项目存在自定义问题,导致一些布局无法预览,生成的缓存文件会导致其他项目预览也失败。
第二种:
如果上面删除依旧无法,可能是你的IDE
JAVA环境引起,由于你本地的JDK在运行,IDE自带的JDK也在运行,也会出现JAVA在加载出现异常,导致布局无法展示,布局是实时刷新。
打开任务管理器,找到AndroidStudio的任务,杀死当前AndroidStudio任务下的Java所有进程。