Ped*_*ro 6 android android-studio material-design android-coordinatorlayout
我知道这个问题已经被问过很多次了,但是我尝试了大多数解决方案,但没有一个对我有用。这是我第一次使用android studio 3.1.3,并且正在遵循有关如何使用android studio中的基本模板选项创建简单应用程序的教程。我面临的问题是;

渲染问题无法在当前主题中找到样式“ coordinatorLayoutStyle”
我尝试将其添加到build.gradle文件中:
编译'com.android.support:design:24.1.1'
还将其放入style.xml
<style name="AppTheme.NoActionBar">
<item name="coordinatorLayoutStyle">@style/Widget.Design.CoordinatorLayout</item>
</style>
Run Code Online (Sandbox Code Playgroud)
styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
Couldn't resolve resource @style/Widget.Design.CoordinatorLayout<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
Run Code Online (Sandbox Code Playgroud)
build.gradle
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.notes"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:28.0.0-alpha3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Run Code Online (Sandbox Code Playgroud)
我遇到了同样的问题。我尝试从此处执行以下步骤,但问题仍然存在。我认为这是android studio 3.0+中的常见问题,希望他们会在下次更新时予以解决。在Android Studio Preview 3.2中,它可以正常工作。下载Android Studio预览版,并访问此处以了解如何与Android Studio稳定版一起运行
或者,您可以尝试将设计库版本降低到27。(而sdk编译版本也降低到27)。
dependencies { implementation 'com.android.support:appcompat-v7:27.0.2' implementation 'com.android.support:design:27.0.2' }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4528 次 |
| 最近记录: |