有很多与此类似的问题,但是我没有具体针对我的代码。他们都没有为此工作。
我正在尝试添加一个工具栏,显示here
但这对我不起作用,因为它向我显示了错误No resource identifier found for attribute 'popupTheme' in package "com.example...
我的代码是这样的:
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/LinearLayoutMain"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</RelativeLayout>
我还添加了
appcompat
和cardview
库,但是仍然遇到相同的错误。有人知道答案吗?请回复。
最佳答案
在style.xml中定义以下样式
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
更改
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
至
app:popupTheme="@style/AppTheme.PopupOverlay"
希望对您有帮助。
关于android - 错误: No resource identifier found for attribute 'popupTheme' in package “com.example…” ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39688359/