Java AAPT:错误:找不到资源样式/Theme.TheDoist.PopupOverlay(又名com.bawp.todoister:style/Theme.TheDoist.PopupOverlay)
有人能帮我解决这个问题吗?我已经导入了一个项目的样本模板,当gradle构建时。我已经查看了很多次代码,但是我对Android编程还不熟悉,所以我不知道这是什么错误以及为什么会出现这个错误 我得到这个错误 我得到的错误Java AAPT:错误:找不到资源样式/Theme.TheDoist.PopupOverlay(又名com.bawp.todoister:style/Theme.TheDoist.PopupOverlay),java,android,mobile,Java,Android,Mobile,有人能帮我解决这个问题吗?我已经导入了一个项目的样本模板,当gradle构建时。我已经查看了很多次代码,但是我对Android编程还不熟悉,所以我不知道这是什么错误以及为什么会出现这个错误 我得到这个错误 我得到的错误 C:\Users\Home\AndroidStudioProjects\Todoister\app\src\main\res\layout\activity_main.xml:14: AAPT: error: resource style/Theme.TheDoist.Popup
C:\Users\Home\AndroidStudioProjects\Todoister\app\src\main\res\layout\activity_main.xml:14: AAPT: error: resource style/Theme.TheDoist.PopupOverlay (aka com.bawp.todoister:style/Theme.TheDoist.PopupOverlay) not found.
主题XML文件
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Todoister" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="Theme.Todoister.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.Todoister.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="Theme.Todoister.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
@颜色/紫色500
@颜色/紫色\u 700
@颜色/白色
@颜色/青色200
@颜色/青绿色700
@颜色/黑色
?attr/colorPrimaryVariant
假的
真的
Activity\u main.xml文件位于下方
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Theme.TheDoist.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/Theme.TheDoist.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_input_add"
tools:ignore="ContentDescription" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dimen_60"
android:padding="@dimen/recycler_padding"
android:visibility="visible">
</androidx.recyclerview.widget.RecyclerView>
<include layout="@layout/bottom_sheet"/>
主题未正确加载。我添加的应用程序布局缺少一个文件,再次运行gradle,问题已解决