如何解决"在'android'包中找不到属性'样式'的资源标识符"?

ees*_*ein 5 android

我创建了一个样式并将其应用于按钮,但是当我尝试构建时,我得到了异常:

No resource identifier found for attribute ‘style’ in package ‘android’

这是按钮的代码:

<Button
            android:text="Settings"
            android:style="@style/SecondaryButton"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/settingsButton"
            android:layout_weight="0" />
Run Code Online (Sandbox Code Playgroud)

可能有什么不对?

ees*_*ein 11

问题是样式标记不需要android包命名空间,即使许多IDE会建议正确.所以代替:

android:style="@style/SecondaryButton"

使用:

style="@style/SecondaryButton"