简体   繁体   English

预览Anko DSL视图

[英]Preview Anko DSL views

I'm looking for a way to preview the rendering of an Anko view DSL in Android Studio. 我正在寻找一种方法来预览Android Studio中Anko视图DSL的渲染。 I've searched a lot and found only some deprecated or not working Android studio plugins. 我搜索了很多,发现只有一些已弃用或不工作的Android工作室插件。 Is there a trick or something to make it works ? 是否有诀窍或其他东西使其有效? The Anko Support plugins doesn't work... Anko支持插件不起作用......

I use Anko support plugins to preview DSL layouts all the time. 我使用Anko支持插件来一直预览DSL布局。 There may be a few reasons why it may not work in your case: 可能有一些原因可能导致您的情况无效:

  1. Your layout should be defined in an external class that implements AnkoComponent interface. 您的布局应在实现AnkoComponent接口的外部类中定义。
  2. Try rebuilding your project if the layout does not render properly. 如果布局无法正确呈现,请尝试重建项目。 The preview works after the project is rebuilt. 重建项目后,预览工作正常。
  3. Try refreshing the layout if that might solve your issue. 如果可以解决您的问题,请尝试刷新布局。
  4. Make sure your Anko dependencies are latest and Android Studio 3+. 确保您的Anko依赖项是最新的和Android Studio 3+。 If you can share more info like the versions of your plugins and your code, maybe I can help pinpoint the exact issue. 如果您可以分享更多信息,例如插件版本和代码,也许我可以帮助查明确切的问题。 Meanwhile here is an article that can surely help you out: https://blog.mindorks.com/how-to-preview-dsl-layouts-made-using-anko-layouts-f885c6bf67b3 与此同时,这篇文章肯定可以帮到你: https//blog.mindorks.com/how-to-preview-dsl-layouts-made-using-anko-layouts-f885c6bf67b3

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

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