AAPT: error: resource style/Theme.TheDoist.PopupOverlay (aka com.bawp.todoister:style/Theme.TheDoist.PopupOverlay) not found
AAPT: error: resource style/Theme.TheDoist.PopupOverlay (aka com.bawp.todoister:style/Theme.TheDoist.PopupOverlay) not found
谁能帮我解决这个问题,我已经导入了一个项目的示例模板,并在 gradle 构建时。我已经研究了很多次代码,但我是 Android 编程的新手,所以我无法弄清楚这是什么错误以及为什么会出现此错误。
我收到这个错误。
我得到的错误
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" />
Activity_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"/>
主题未正确加载我添加的 App Layout 文件丢失,再次 运行 gradle,已解决。
谁能帮我解决这个问题,我已经导入了一个项目的示例模板,并在 gradle 构建时。我已经研究了很多次代码,但我是 Android 编程的新手,所以我无法弄清楚这是什么错误以及为什么会出现此错误。
我收到这个错误。
我得到的错误
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" />
Activity_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"/>
主题未正确加载我添加的 App Layout 文件丢失,再次 运行 gradle,已解决。