1 Creating The colors.xml File

1.1 Definition

This xml define basic colors for your app here both for primary and secondary text, and backgrounds “DESCRIPTION TO BE ADDED LATER”. For example:

1.2 Creation

To create the colors.xml file create the file in the values folder. You can do this by first opening:

projectname>app>src>main>res>values.

colors-xml-directory

Right click on the ‘values’ folder go to New>Values resource file. And then type in colors.xml and press OK to create it in the folder.

colors-xml-new-resource-file

colors-xml-new-resource-file-window

You will now have a colors.xml file in your values folder.

colors-xml-file-res-folder

Double click it to make sure it is opend in the editor window.

colors-xml-opened

Once you are sure you have opened the colors.xml file in the editor copy and paste the entire code below and replace all the contents of the current colors.xml file.

colors-xml-completed

You are done! Save the entire project and close the colors.xml tab from the editor.

Colors.xml created!


2 Updating The values/styles.xml And Creating values-v21/styles.xml

2.1 Definition

We define theme here for our app. We define the color and font size of action bar from here. For each style you want to create, add a <style> element to the file with a name that uniquely identifies the style (this attribute is required).

Then add an <item> element for each property of that style, with a name that declares the style property and a value to go with it (this attribute is required). The value for the <item> can be a keyword string, a hex color, a reference to another resource type, or other value depending on the style property. “DESCRIPTION TO BE ADDED LATER”

For example, following style is used for action bar in this app.

2.2 Creation

First we need to create a ‘values-v21’ folder in the ‘res’ folder. Start by opening up the directores projectname>app>src>main>res, then right click on ‘res’ and select New>Android resource directory.

styles-xml-android-resource-directory

In the New Resource Directory window scroll down the Available qualifers list until you see the version entry. Select ‘version’ then press the ‘>>’ button to procced.

styles-xml-new-resource-directory-version

At the next window type in 21 in the API Level field. It will automatically enter in values-v21 as the directory name. Press OK to create the new directory.

styles-xml-new-resource-directory-version-21

styles-xml-v21-folder

Once the values-v21 has been createad right click on it and then New>Values resource file. Type in styles.xml and press OK.

styles-xml-values-resource-file

styles-xml-values-resource-file-window

You should have a styles.xml file in both your values-v21 and values folder of your project.

styles-xml-in-values-and-values-v21-folders

If the styles.xml does not exist in your values folder, then create it the same way as how styles.xml was created for the values-v21 folder.

Next, double click the styles.xml of the values folder so that it opens up in the editor.

styles-xml-opened

Then copy and paste the following code below into styles.xml in the values folder, replacing all the current contents with the copied code.

styles-xml-completed-and-saved

Save and close the styles.xml tab after pasting in the contents.

Next, double click styles.xml file of the values-v21 folder to open in the editor.

styles-xml-v21

Copy the following code below and paste it in the styles.xml file of the values-v21 folder. Replacing the existing contents with the copied code. Save and then close the v21/styles.xml tab when done.

styles-xml-v21-completed-and-saved

styles.xml DONE!


Click a link below to go to the previous or next step of the setup

Back to Part 3 of the Company App

On to Part 5 of the Company App

Free App!

Want to build the complete Company Profile app, and download all graphics, etc used?

Grab my free 200+page ebook which contains the complete source code/setup for this app, and all graphics. It’s 100% free!