/storage/emulated/0/.sketchware/data/743/files/resource/layout/custom_action_item_layout.xml:2:错误:错误:找不到与给定名称匹配的资源(位于'style‘,值为’?attr/actionButtonStyle‘)。,,/storage/emulated/0/.sketchware/data/743/files/resource/menu/main_menu.xml:6:错误:在包'com.my.newproject9’中找不到属性'actionLayout‘的资源标识符,,/storage/emulated/0/.sketchware/data/743/files/resource/menu/main_menu.xml:6:错误:在包'com.my.newproject9‘中找不到属性'showAsAction’的资源标识符,
发布于 2021-07-11 00:35:28
你可能已经从某个地方引用了attr actionButtonStyle,并且这个属性没有在你的应用程序主题中设置。
假设你的应用程序使用的是材料主题,首先,为你的按钮创建一个主题。以下是一个示例,您可以根据需要对其进行自定义:
<style name="Widget.App.Button" parent="Widget.MaterialComponents.Button">
<item name="materialThemeOverlay">@style/ThemeOverlay.App.Button</item>
<item name="android:textAppearance">@style/TextAppearance.App.Button</item>
<item name="shapeAppearance">@style/ShapeAppearance.App.SmallComponent</item>
</style>现在,在应用程序主题中,将此属性值设置为新主题:
<!--Your app theme might be different than the following, just put that attribute inside-->
<style name="Theme.App" parent="Theme.MaterialComponents.*">
...
<item name="actionButtonStyle">@style/Widget.App.Button</item>
</style>霍普,这有帮助。
https://stackoverflow.com/questions/68329593
复制相似问题