gpt4 book ai didi

android - CoordinatorLayout 在 Android Studio 3.1.3 中不起作用?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:52:58 25 4
gpt4 key购买 nike

我知道这个问题已被问过很多次,但我已经尝试了大部分解决方案,但没有一个对我有用。这是我第一次在 android studio 3.1.3 上工作,我正在学习如何使用 android studio 中的基本模板选项创建一个简单应用程序的教程。我面临的问题是; enter image description here

Render Problem Failed to find style 'coordinatorLayoutStyle' in current theme

我尝试将其添加到 build.gradle 文件中:

compile 'com.android.support:design:24.1.1'

也把这个放到style.xml中

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

样式.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>

构建.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'
}

最佳答案

我遇到了同样的问题。我尝试了以下步骤 from here ,但问题仍然存在。我认为这是 android studio 3.0+ 中的一个常见问题,希望他们能在下次更新时修复它。在 Android Studio Preview 3.2 中它工作正常。 Download Android Studio Previewvisit here了解如何将其与 Android Studio 稳定版一起运行

enter image description here

或者你可以尝试将你的设计库版本降低到27。(并且编译sdk版本也降低到27)

dependencies { implementation 'com.android.support:appcompat-v7:27.0.2' implementation 'com.android.support:design:27.0.2' }

关于android - CoordinatorLayout 在 Android Studio 3.1.3 中不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50958110/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com