Search code examples
javaandroidmobileapktool

How to change @color in a application


I have a source code for an application. I try to change the colors in it.After i find the color background (i think it is) so i see this tag @color/material_grey_800 . Can you tell me how to change it? Thanks. Picture


Solution

  • You can change the color profile of a color by simply changing the value (color hex codes or color profiles that come packaged with Android) in-between the color tags. For instance:

    <color name="colorBlack">#000000</color>
    

    ... or:

    <color name="colorBlack">@android:color/black</color>
    

    ... and then a sample implementation of referencing a color profile in say, a View's background, is as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:background="@color/colorBlack"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        ...
    
    </RelativeLayout>