Failed to Find Style 'Coordinatorlayoutstyle' in Current Theme

Failed to find style 'coordinatorLayoutStyle' in current theme

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.

Failed to find style ... in current theme

You can copy the style name floatingactionbuttonstyle and included it in your apptheme.

Add this line

<item name="floatingActionButtonStyle">@style/Widget.Design.FloatingActionButton</item>

And finally theme look like this

   <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>

<item name="floatingActionButtonStyle">@style/Widget.Design.FloatingActionButton</item>

</style>

Just add the style name when error occured in layout editor & add the responding styles.

Here some other few elements am added in styles for others.

   <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="chipStyle">@style/Base.Widget.MaterialComponents.Chip</item>
<item name="chipGroupStyle">@style/Widget.MaterialComponents.ChipGroup</item>
<item name="bottomNavigationStyle">@style/Widget.Design.BottomNavigationView</item>
<item name="coordinatorLayoutStyle">@style/Widget.Support.CoordinatorLayout</item>
<item name="bottomAppBarStyle">@style/Widget.MaterialComponents.BottomAppBar</item>
<item name="floatingActionButtonStyle">@style/Widget.Design.FloatingActionButton</item>
</style>

You can add default style with style name. Then you resolve this error.

Failed to find style 'coordinatorLayoutStyle' in current theme (Render error)

Try adding the following style.

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


Related Topics



Leave a reply



Submit