简体   繁体   English

将标题栏和文本的颜色更改为十六进制值

[英]Change colour of title bar and text to hex values

I want to change the colour of the title bar and the text within it to hex values. 我想将标题栏的颜色和其中的文本更改为十六进制值。 What is the quickest and easier way to achieve this? 什么是最快,更轻松的方法来实现这一目标? Can this be achieved using the manifest xml file? 可以使用清单xml文件来实现吗?

You can find how to customize your action bar here 您可以在此处找到如何自定义操作栏

As for setting the values to simply be a hex, the best method to do that is to declare a colors.xml file since any colors you set to the action bar will likely be used elsewhere as well. 至于将值设置为简单的十六进制,最好的方法是声明colors.xml文件,因为您在操作栏上设置的任何颜色也可能会在其他地方使用。 Declaring it in xml allows for efficient reuse of the same values. 在xml中声明可以有效地重用相同的值。

** Edit ** Here's a simple color file. **编辑**这是一个简单的颜色文件。 It would be saved in res/values/colors.xml 它将保存在res / values / colors.xml中

 <?xml version="1.0" encoding="utf-8"?>
 <resources xmlns:android="http://schemas.android.com/apk/res/android">

<color name="black_overlay">#66000000</color>
<color name="default_screen_bg">#20324a</color>
<color name="rounded_container_bg">#80000000</color>
<color name="rounded_container_border">#3b3f44</color>
<color name="light_gray_header_color">#646663</color>

</resources>

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

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