问题
I'm using the latest version of Android Studio (3.1.3) with build tools 28.
The layout does not get rendered in the design tab when I'm using coordinator layout. Many have pointed out that to get around this problem is to add the following lines in the style.xml:
<style name="AppTheme.NoActionBar">
<item name="coordinatorLayoutStyle">@style/Widget.Design.CoordinatorLayout</item>
</style>
However adding the lines produces the following error: Cannot resolve symbol '@style/Widget.Design.CoordinatorLayout'.
Is there away to get around this issue?
回答1:
Try (API 28)->
<style name="AppTheme.NoActionBar">
<!--<item name="coordinatorLayoutStyle">@style/Widget.Design.CoordinatorLayout</item>-->
<item name="coordinatorLayoutStyle">@style/Widget.Support.CoordinatorLayout</item>
</style>
回答2:
This works in my version of studio (3.1.3):
Change this 2 lines in your gradle app file (build.gradle)
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0-alpha1'
and resync.
Delete line
<item name="coordinatorLayoutStyle">@style/Widget.Design.CoordinatorLayout</item>
if you still have it in your styles.xml file.
回答3:
Try this: @style/Widget.Support.CoordinatorLayout
回答4:
I Hope this will work for you.
implementation 'com.android.support:design:27.1.1'
add above line in app gradle file and instead of 27.1.1 use your library version(i.e 28.x.x)
来源:https://stackoverflow.com/questions/51015934/cannot-resolve-symbol-style-widget-design-coordinatorlayout