.9.pngs figured out. New thread!

Search This thread

damnitpud

Senior Member
Jul 6, 2007
476
5
RI
My experience the biggest issue with not compiling is the outter edge isn't pure black or some of the effects cause dim imperfections around the edge. Eclipse will tell you if there are errors...if you dont have the problems tab at the bottom, go to Window, Show view, Problems.

Hope that helps.
 

damnitpud

Senior Member
Jul 6, 2007
476
5
RI
I've compiled with warnings similiar to that. Not sure why it doesnt bring the images over. Open them in the draw9patch tool and make sure there are guides on all 4 sides.

Alot of times when Eclipse wont compile when you open the image in draw9patch it will show a missing guide.
 

smeyerhuky

Senior Member
Jan 26, 2009
115
11
sdk has .9s with guides

I have noticed somethin interesting about the .9s...

In the sdkfolder "/tools/lib/res/default/drawable" there are .9s(most of which are needed to edit for a theme...
Interesting thing is all these .9s still have guides. I have managed to just edit the images (change color or other basic edits....) andthen using the method in the first post to compile them in eclipse. Works great for me haven't had a problem yet, just be sure to back them up so you can use them over and over again....

Another nice thing is to just take the one you edited, and add it as a layer to the one from the SDK, if all goes as it did for me the edited one from you should be 1 pixel shorter on each side causing the layer to default at the center of the sdk's .9 file.
DO NOT EDIT THE GUIDES FROM THE SDK'S .9s, be sure to save the new .9s and then compile in eclipse...

Hope this helps... if anyone gets errors doing this please let me know so I can replicate and fix the error....
 

damnitpud

Senior Member
Jul 6, 2007
476
5
RI
I have noticed somethin interesting about the .9s...

In the sdkfolder "/tools/lib/res/default/drawable" there are .9s(most of which are needed to edit for a theme...
Interesting thing is all these .9s still have guides. I have managed to just edit the images (change color or other basic edits....) andthen using the method in the first post to compile them in eclipse. Works great for me haven't had a problem yet, just be sure to back them up so you can use them over and over again....

Another nice thing is to just take the one you edited, and add it as a layer to the one from the SDK, if all goes as it did for me the edited one from you should be 1 pixel shorter on each side causing the layer to default at the center of the sdk's .9 file.
DO NOT EDIT THE GUIDES FROM THE SDK'S .9s, be sure to save the new .9s and then compile in eclipse...

Hope this helps... if anyone gets errors doing this please let me know so I can replicate and fix the error....

Some good info...those images are what are in the first post...they are from the sdk and source.
 

smeyerhuky

Senior Member
Jan 26, 2009
115
11
i know, it was more the quicker layer on top of layer process i was trying to point out for an easier/quicker process... thats alll. thanks for all yopur hard work.
 

damnitpud

Senior Member
Jul 6, 2007
476
5
RI
An even quicker way is to use the original file from the update.zip, make your changes...then go to Image\Canvas Size(Alt+Cntrl+C) add 2 pixels to width and height, then using a 1px Pencil draw in the guides. At first you will want to check your work by opening it the draw9patch tool. but once you get the hang of it you should be able to skip this step.
 

manup456

Senior Member
Dec 10, 2008
4,519
1,108
Danbury
www.creativeminds.graphics
@damnitpud

I got everything but when i start a new Android project in eclipse and put the path to the folder where the image is it asks for name i put the name of the icon and it says this.

File AndroidManifest.xml not found in tools.
 

damnitpud

Senior Member
Jul 6, 2007
476
5
RI
@damnitpud

I got everything but when i start a new Android project in eclipse and put the path to the folder where the image is it asks for name i put the name of the icon and it says this.

File AndroidManifest.xml not found in tools.

What doy ou mean but in the path to the image? I always open eclipse expand the folders until i see drawable, then drag the images from Windows Explorer to the drawable folder.

Does that make sense?
 

manup456

Senior Member
Dec 10, 2008
4,519
1,108
Danbury
www.creativeminds.graphics
I use this C:\Users\owner\Desktop\android-sdk-windows-1.0_r2\tools for location and there is a part on top it says project name what should that be? because everything i type in i get that message ontop.

Also what do i need to have in the SDK tools folder another folder named what and what should i have in it? Lets say its the top box icons in launcher for the top of the folders when there open. I made the edits should i put just the icons in this folder im creating in tools or do i need the drawable folder with all the icons?

Sorry for all the Q: but the guide does not mention any of this.

Thanks for the help.
 

damnitpud

Senior Member
Jul 6, 2007
476
5
RI
link it to one of the samples...When you create a new project it has an option for open existing project, try opening the HelloActivity one at C:\Users\owner\Desktop\android-sdk-windows-1.0_r2\samples\HelloActivity

This will fill in all the info for you. Which will give you an idea of what to put in those boxes for future use. Once you get into Eclipse with that project loaded, expand the HelloActivity,res and you will see the drawable folder. That is where you drag the images.
 
Last edited:

tehseano

Senior Member
Jan 23, 2009
829
16
Thank you so much damnitpud!! Your methods work perfectly! I hope at some point we can find a shorter, easier process for doing this. It also makes it very annoying when adding the guides to have to punch in pixel by pixel, would kill for a line tool for setting the contents guides haha.

But once again, thanks a ton!
 

damnitpud

Senior Member
Jul 6, 2007
476
5
RI
Thank you so much damnitpud!! Your methods work perfectly! I hope at some point we can find a shorter, easier process for doing this. It also makes it very annoying when adding the guides to have to punch in pixel by pixel, would kill for a line tool for setting the contents guides haha.

But once again, thanks a ton!

Once you learn where the guides go and how they are supposed to line you can just resize the canvas by 2px height and 2px width then use the pencil tool =)
 

tehseano

Senior Member
Jan 23, 2009
829
16
Once you learn where the guides go and how they are supposed to line you can just resize the canvas by 2px height and 2px width then use the pencil tool =)

Really? I thought I had to use drawpatch to compress the image to a .9.png and whatnot, but as long as I just make a black line in the extra 2px, eclipse will remove them and compile them correctly? Awesome!
 

damnitpud

Senior Member
Jul 6, 2007
476
5
RI
Yeah takes you a bit to get used to doing it that way. But once you do you will hardly ever bring up the draw9patch tool. Once in a awhile i open it on some images...but hardly ever anymore.

You're doing basically what the draw9 tool does if the file doesn't have a .9 in the file name. When it saves the file it adds the .9 to it.
 

manup456

Senior Member
Dec 10, 2008
4,519
1,108
Danbury
www.creativeminds.graphics
Yeah this makes it easier but i still use 9patch to make sure the images look the way i want. sometimes when you add guide lines with CS3 when you put it in eclipse it shows the icon to be bad and if you open it with 9patch and save it eclipse will recognize it fine.
 

damnitpud

Senior Member
Jul 6, 2007
476
5
RI
Yeah this makes it easier but i still use 9patch to make sure the images look the way i want. sometimes when you add guide lines with CS3 when you put it in eclipse it shows the icon to be bad and if you open it with 9patch and save it eclipse will recognize it fine.

I noticed it gave me errors when i tried to pick black from the color picker. it would end up being 010101 if you make sure its 000000 you wont have an issue.
 

tubaking182

Senior Member
Mar 28, 2008
1,081
10
headache

alright, i thought i had learned enough about theming to start screwing with the .9 images, but apparently i'm too dumb to get eclipse to open a new android project. attached is what my screen looks like after i click Android Project(i edited my name from my name to ***** for the pic)

aany help would be greatly appreciated, this is driving me insane i wanna make my next theme amazing
 

tehseano

Senior Member
Jan 23, 2009
829
16
Try giving it a different name than the application, name the project YourNameG1 or something.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    Well my old thread got deleted, So i decided to redo it.

    I am sure by now most of you know that editing .9.pngs cause some ill effects on certain images. Well i found a way to edit these images and make them look as good as Google's!

    What you need:
    Android SDK - Will be using the draw9patch tool in the tools folder.
    Eclipse IDE - We will need this to compile the .9s
    Photoshop or other image editing sfotware - with PNG compression.

    Setting up the enviroment:
    When i setup the SDK and Eclipse, i put them inside of C:\Android. Make sure to follow the instructions from here, it will walk you through setting up Eclipse to work properly with Android.

    ::Tip:: When you get to the part "Installing the Eclipse Plugin (ADT)" the URL "https://dl-ssl.google.com/android/eclipse/" sometimes gives an error, just change https to http and it should go through without an issue.

    Now basically put a .9.png is an image with guides that tells Android where the image can be stretched and where the content will be placed inside the image. An easy example is a button, some fit only one word and others stretch across the whole screen and Android will put the text in the middle of the button.

    When you open a .9.png you do not see the guides, that is because they are hidden. When you want to add the guides to an image, you have to drag it into the draw9patch tool. Now the tool has a hidden secret i figured out.(not really hidden, but not well described) If you open an image with the .9.png extension it just opens it. But if you open an image without the .9.png extension, it adds 2 pixels to its width and height. These 2 pixels are for the hidden guides. For example the btn_default_normal_disable.9.png in framework is 44x48. But if you remove the .9 from the file name and drag it into the draw9patch tool it changes to 46x50. Which you will notice after you save the image from the draw9patch tool. Also it will add the .9 to the file name.

    Howto: draw9patch
    The idea of the draw9patch tool is very simple, you drag an image into it you create the guides and you save the image. But the guides are very specific and if you do not do them properly your image will look strange. So follow these few rules about the tool.

    Remove the .9 from image name before you drag it into the tool.
    The top and left side guides set where the image can be stretched. Where ever you put a guide is where the image will stretch. Do not put more then 2 next to each other.
    The bottom and right side guides set the content area(where the text will go). Now you can only put the guides in the outer border, once the image is compiled this border will be hidden. The tool will not let you put any guides anywhere but the outside border. Now usually you will put a 1x1 guide on the top and left sides, on the right and bottom you want to draw a full line. I have tried putting multiple guides on the top and left but the aapt tool seems to stress out and crash before compiling.

    Once you save the image the draw9patch tool should of added the .9 to the name. That is all to adding the guides to the image.

    So now your saying ok, i have the image and i still see the guides. To get rid of these lines we need to compile them with Eclipse. Basically we add them to a project in Eclipse and create an apk. During the compile the aapt tool from the sdk will set the image back to its original resolution and hide the guides.
    (I am hoping to figure out some command lines for the aapt tool so we can skip this step. But until then editing these .9s are a big pain in the arse!)

    Howto: Compiling in Eclipse.
    I am assuming you followed the link above for setting up Eclipse and can create a new Android project.

    Once Eclipse is open you want to go to "File\New\Android project". Select "Create project from existing source". It should default to the path of the samples in your SDK directory, but if it doesn't just browse to them. I have been using my own project but any sample should be fine. Choose "Finish" and on the left hand side under Project Explorer, you will see the name of the project you opened. Expand the project, then Res and you will see the Drawable folder. You will want to drag your edited .9s here. Once all of the images are in the drawable folder you want to right click the top level folder(Project name) for your project and choose "Android Tools"(second from botom) then "Export Unsigned Application Package..." Save the apk where ever you'd like, just remember where you put it. Cause you will want to open it and take the images out of the drawable folder. You will notice now that the guides are gone and the resolution is back to the normal size. Drag the images into your theme and you are done.

    The images below are some screen shots of the draw9patch tool. The first one shows how most of the .9s should look with guides, the second shows with the Show Content checked and the third is what happens when you put your mouse inside the outer pixel range.

    Attached is a zip with the drawables from framework-res, launcher, contacts and phone apks from the source. It has the .9s and xmls before being compiled, so you can use these images instead of having to use the draw9patch tool. But it doesn't have all of the same images, there are some missing and some that are not in our firmware yet. So do not just copy and paste all of the images, i have been just copying certain ones into my theme directory and editing them there. Also becareful when editing these images, if any of the guides color changes Eclipse will throw an error. This is easily fixed by using a 1 pixel pencil tool in photoshop and going over the guides with black. Also you need to make sure that there is not anything other then the black guides in the 1 pixel border of the images. you will get errors before compiling if there are. I normally use the rectangle marquee tool to highlight the edge and use the Del key to make sure nothing is in the outside edge.
    1
    Hi,

    Thanks heaps for this, helped me a lot :)

    Just wanted to note that you can compile/decompile the .9.png's with apktool.

    I've written a rough guide here
    1
    attachment.php