This guide will go over how to edit various resource xmls with VTS. As an example this tutorial will use framework-res.apk and SystemUI.apk from a HTC Sense 4 ROM.
Please keep in mind that there is a huge list of possible resources in Android, so this document will cover only the most important ones.
bools.xml is part of Boolean algebra, developed by in 1854 by George Boole. Just like Boolean algebra, bools.xml uses the algebra of truth values 0 and 1 which are represented in bools xml as true and false. Basically bools.xml contains switches for different features in the apk. In this example we will look at the bools.xml in framework-res.apk.
- First lets set up the project. If you do not know how to set up a project please read Setting up your first project.
- Once you have imported framework-res.apk, go down to res/values and open bools.xml.
- Look at line 6, you will see the following (or something else) <bool name=”show_ongoing_ime_switcher”>true</bool>
- Change the “true” to “false” and you have turned the IME Switch on the statsubar off. It will no longer appear.
colors.xml controls the majority of the colors that are used in the apk. It sets text colors, highlight colors, and background colors amongst some others. It is important to note that not all colors are in this xml, some colors might be in the xmls in the layout folder, color folder and styles.xml, even smali code contains colors sometimes; however, editing colors in any xml is pretty much the same.
- Colors are defined by eight characters in hexadecimal. Hexadecimal uses numbers 0-9 and the first six letters of the alphabet A-F. The first two characters set the alpha (transparency) level and the remainig six characters define the color.
- Go to res/values and open colors.xml.
- Here you will see a bunch of color values. These can easily be changed to any color of your choice by editing the last six digits of the hex value. As an example, I have changed all the green colors to different shades of ICS Blue.
dimens.xml controls the dimension of various images, fonts, and bars among other things. As an example I will explain how to remove the 3-dot menu on the bottom of apps that are not ICS optomized.
- Go to res/values and open dimens.xml
- Here you will see all the dimension values that control many aspects of the app. You really dont want to edit anything on this xml unless you know exactly what you are doing.
- Look at lines 15 and 16. These two lines control the height and width of the 3-dot menu bar. simply by setting the value to “0.0dip” you will remove the 3-dot menu bar.
drawables.xml define what images and colors are used in the app. Basically an xml in the layouts folder calls images and background colors from this xml. The majority of the edits you will do on this xml are related to colors, so just edit them as explained in the colors.xml section.
strings.xml control the text strings that are used in the app. As an example I will show you how to edit the “Android is upgrading” text that appears after flashing a rom or wiping the cache.
- Go to res/values and open strings.xml
- Look at line 996, here you can change the text to anything you want. Ex. change “Android is upgrading…” to “Your phone is optimizing…“
styles.xml define how text and some images appears on the device. In styles.xml you will see references to dimensions, color, strings, and drawables. Basically this xml controls the style of the strings and backgrounds. It tells the app what string to use, what size the text has to be, if the text is bold, italic, underlined, etc.
Most of the edits in styles.xml you will do are color related, so editing this xml is much like editing colors.xml.
- As an example I will use the styles.xml from SystemUI.apk. So add a project to the solution and import SystemUI.apk.
- Once you have done this go to res/values and open styles.xml.
- Here you can change the textcolor of the clock. Look for TextAppearance.StatsuBar.Clock and change the textColor reference to your color of choice. If no textColor reference is present you can add one by typing the following
- <item name=”android:textColor”>#ffffffff</item>
- You can replace the ffffffff to any hexadecimal color you want.
- It is also important to note that text color references can come up as “@color/list_primary” instead of an actual color. When this happens you have two options, track the color down to colors folder or colors.xml or change “@color/list_primary” to a hex value, ex. “#ff000000“
There is many more things you can do in these xmls, this is just something to get you started.