简体   繁体   English

Android动作栏动作颜色

[英]Android action bar action color

I have an application with a lot of activities, that all use the same theme: 我有一个包含很多活动的应用程序,它们都使用相同的主题:

<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="colorPrimary">#aaa</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

Activities all have action bar looking like by the lines of: 所有活动都有动作条,看起来像是:

当前动作栏

What I just can't figure out is, how to color action buttons (pencil on the right) to black. 我只是不知道是如何将操作按钮(右侧的铅笔)涂成黑色。

Essentially I want to have white action bar (on screenshot is white just for action button to be visible) with black title, back arrow and action buttons, but I don't want to add Toolbar view to every activity I have. 本质上,我希望拥有带有黑色标题,后退箭头和动作按钮的白色动作栏(屏幕截图上的白色只是为了显示动作按钮),但是我不想将Toolbar视图添加到我拥有的每个活动中。

So, is there a way to color action buttons black by XML? 因此,有没有一种方法可以通过XML将操作按钮涂成黑色?

Create vector icons for your menu items and set their color to black (in your case you won't need to set their color as they are black by default). 为菜单项创建矢量图标并将其颜色设置为黑色(在您的情况下,您无需将其颜色设置为默认颜色,因为它们是黑色的)。 To create vector asset go to File - New - Vector Asset . 要创建矢量资产,请转到“ File - New Vector Asset
You can also download an icon from the internet as svg file and import it through vector asset creating dialog. 您也可以从Internet下载一个图标作为svg文件,并通过矢量资产创建对话框将其导入。
The list of default icons is also available here . 默认图标列表也在此处提供

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM