且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法在当前主题中找到样式“coordinatorLayoutStyle"

更新时间:2023-01-27 23:36:56

我通过简单地将这一行插入应用程序主题(应用程序主题通常放在 styles.xml 中)解决了这个渲染问题.

[SDK 28]

[SDK 27]

正如@Chris 所建议的那样.如果 IDE 在 Widget.SupportWidget.Design 中没有找到 CoordinatorLayout,只需开始输入CoordinatorLayout",它应该会给你一些选项.

I'm using the latest version of android studio (3.0), along with latest build tools (27) and similar API level.

The layout does not get rendered in the design tab and it's causing a lot of trouble especially that I'm using coordinator layout.

How do I get around this problem?

I solved this rendering problem by simply inserting this line into the application theme (the app theme is usually placed in styles.xml).

[SDK 28]

<style name="AppTheme">
  <item name="coordinatorLayoutStyle">@style/Widget.Support.CoordinatorLayout</item>
</style>


[SDK 27]

<style name="AppTheme">
  <item name="coordinatorLayoutStyle">@style/Widget.Design.CoordinatorLayout</item>
</style>


As suggested by @Chris. If the IDE does not find the CoordinatorLayout in Widget.Support or Widget.Design, just start typing "CoordinatorLayout" and it should give you some options.