首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用value‘创建'style’?attr/actionButtonStyle

如何使用value‘创建'style’?attr/actionButtonStyle
EN

Stack Overflow用户
提问于 2021-07-11 00:24:41
回答 1查看 14关注 0票数 0

/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’的资源标识符,

EN

回答 1

Stack Overflow用户

发布于 2021-07-11 00:35:28

你可能已经从某个地方引用了attr actionButtonStyle,并且这个属性没有在你的应用程序主题中设置。

假设你的应用程序使用的是材料主题,首先,为你的按钮创建一个主题。以下是一个示例,您可以根据需要对其进行自定义:

代码语言:javascript
复制
<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>

现在,在应用程序主题中,将此属性值设置为新主题:

代码语言:javascript
复制
<!--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>

霍普,这有帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68329593

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档