Remove All Ads from XDA

# XML Edits How to [ Updated \ 07/24/09 ]

1,203 posts
Thanks Meter: 410

By Stericson, Retired Senior Mod / Senior Recognized Developer - Godfather of Android Theming on 4th February 2009, 10:08 AM
I will be adding information to help people complete XML hacks here, however, This is not a simple thing to do!
This is not something you just fall into. Sure, I can tell you what to change for certain effects but you wont learn anything. So other then taking what somebody has done and using it yourself I will not give direct directions on how to create certain effects.

I will help you learn but I will not do it for you.

The first thing to go over is what you will need.

You no longer need to download the source for a reference.
You can find the entire source here: http://www.netmite.com/android/mydroid/
I use it as a reference all the time when I'm on windows.

I have uploaded a file called resourcetypes/h that contains alot of information in it about how things are translated to binary, in fact everything I will document below was retrieved from that file.

Keep in mind that Android looks at things in bits when compiling this code into hex. And since in hex all we deal with are bytes we need to do some quick math.

In every byte (00) there are 8 bits When you see something in the code like this: uint16_t size; That is android talking about 16 bits which in hex is 2 bytes because every byte is equal to 8 bits.

Got it? Good...
Lets take a look at some code!

Code:
```   // Number of bytes in this structure.
uint16_t size;```
This means the first two bytes reference how many bytes are in this structure. Specifically speaking, for the most part everything we will deal with here is five bytes long. So the first values in hex would be 05 00 if there were five bytes in this structure...

Code:
```    // Always set to 0.
uint8_t res0;```
This means the next byte will always be zero, since its 8 bits its only one byte. Which would look like this in hex 00 So combined with what we have above we should see 05 00 00

Code:
```
// Type of the data value.
enum {```
enum in this case means that the next byte will be one of the following values depending on what it is we are translating to binary.

Code:
```        // Contains no data.
TYPE_NULL = 0x00,```

Means this byte should be 00 and the byte after it holds no data... So the structure would be 05 00 00 00 ... so far....

Code:
```        // The 'data' holds a ResTable_ref, a reference to another resource
// table entry.
TYPE_REFERENCE = 0x01,```
Means the byte(s) after this byte 01 holds a pointer to a resource, which could be an image or any other type of resource stored with Resources.arsc. So combined with what we have above we should see 05 00 00 01

Code:
```        // The 'data' holds an attribute resource identifier.
TYPE_ATTRIBUTE = 0x02,```
Means the byte(s) after this byte 02 points to an attribute in the resources.arsc. So combined with what we have above we should see 05 00 00 02

Code:
```        // The 'data' holds an index into the containing resource table's
// global value string pool.
TYPE_STRING = 0x03,```
Means the byte(s) after this byte 03 points to a string in the string table of resources.arsc. So combined with what we have above we should see 05 00 00 03

Code:
```        // The 'data' holds a single-precision floating point number.
TYPE_FLOAT = 0x04,```
Means the byte(s) after this byte 04 Holds a floating point number...
So combined with what we have above we should see 05 00 00 04

Code:
```        // The 'data' holds a complex number encoding a dimension value,
// such as "100in".
TYPE_DIMENSION = 0x05,```
Means the byte(s) after this byte 05 holds the value of dimension...a lot of times this can be a vlaue for a height or a width of an object, such as an image. So combined with what we have above we should see 05 00 00 05

Code:
```        // The 'data' holds a complex number encoding a fraction of a
// container.
TYPE_FRACTION = 0x06,```
Means the byte(s) after this byte 06 holds a complex number encoding a fraction of a container. So combined with what we have above we should see 05 00 00 06

Code:
```        // Beginning of integer flavors...
TYPE_FIRST_INT = 0x10,

// The 'data' is a raw integer value of the form n..n.
TYPE_INT_DEC = 0x10,
// The 'data' is a raw integer value of the form 0xn..n.
TYPE_INT_HEX = 0x11,
// The 'data' is either 0 or 1, for input "false" or "true" respectively.
TYPE_INT_BOOLEAN = 0x12,```
Same rules apply here...I dont think I have to keep explaining them all....

Code:
```        // Beginning of color integer flavors...
TYPE_FIRST_COLOR_INT = 0x1c,

// The 'data' is a raw integer value of the form #aarrggbb.
TYPE_INT_COLOR_ARGB8 = 0x1c,
// The 'data' is a raw integer value of the form #rrggbb.
TYPE_INT_COLOR_RGB8 = 0x1d,
// The 'data' is a raw integer value of the form #argb.
TYPE_INT_COLOR_ARGB4 = 0x1e,
// The 'data' is a raw integer value of the form #rgb.
TYPE_INT_COLOR_RGB4 = 0x1f,

// ...end of integer flavors.
TYPE_LAST_COLOR_INT = 0x1f,

// ...end of integer flavors.
TYPE_LAST_INT = 0x1f
};```
Means the byte(s) after this byte holds a color value. If the 4th byte is 1C Then the bytes afterwards will define a color value that is in the format #FFFFFFFF transparency, red, green, blue.

If the byte is 1E Then the bytes following will represent a color value in the format #FFF Red, green, blue.

HOWEVER, one thing important to know here is that regardless of the format of the color value whether it be RGB or AARRGGBB Android will convert it to hex and it will appear as FF FF FF FF

Code:
`    uint8_t dataType;`
This is where the FIFTH byte gets added, whatever it may be...it will be one of the values listed above.

I will add more stuff later. The file posted below has everything I've added and more....If you want to know more...open that files up and read it...study it...

Stericson
Attached Files
 ResourceTypes.zip - [Click for QR Code] (14.2 KB, 3827 views)

4th February 2009, 10:52 AM |#2
Recognized Developer
AGAWAM, MA
Thanks Meter: 592

Donate to Me
More
Thanks for this, I'm sure these files will come in handy. Again thanks for all your hard work.
4th February 2009, 01:23 PM |#3
Recognized Themer
Danbury
Thanks Meter: 1,104

Donate to Me
More
Thanks bro great work keep it up!!!!!!
4th February 2009, 03:04 PM |#4
Senior Member
Satellite Beach, Florida
Thanks Meter: 14

More
Wickedly Awesome, you guys go beyond the expected! Thanx to Stericson and JF!!
That is the exact theme i am looking for. No apps tab, black status bar, just wicked!
4th February 2009, 03:12 PM |#5
Senior Member
Houston
Thanks Meter: 0

More
nevermind, I should have read through it more
5th February 2009, 01:07 AM |#6
Senior Member
Manchester
Thanks Meter: 1,038

Donate to Me
More
thanks for this, looks excellent!!
only problem is the red-clock didn't work and now i have no clock at all.
god knows how i ****ed this up :P
5th February 2009, 01:25 AM |#7
OP Retired Senior Mod / Senior Recognized Developer - Godfather of Android Theming
Thanks Meter: 410

More
Well, if you read my post all the way, you would have read that I specifically said that the clock wouldn't work right now.

And you do have a clock it's just blending with the status bar.

Stericson
6th February 2009, 09:40 PM |#8
OP Retired Senior Mod / Senior Recognized Developer - Godfather of Android Theming
Thanks Meter: 410

More
Bump....I have added a screenshot of the customized loickscreen I made.

Stericson
6th February 2009, 09:48 PM |#9
Senior Member
Los Angeles
Thanks Meter: 32

More
how did you make that lock screen?
6th February 2009, 09:58 PM |#10
Senior Member
Houston
Thanks Meter: 0

More
looking good man!
6th February 2009, 11:26 PM |#11
Senior Member
San Diego
Thanks Meter: 71

More
Stericson is the man!

Looks like my donation is going to good use, I will have to send some more beer money your way.

 Guest Quick Reply (no urls or BBcode) Message:
 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode