John Ubonty
John Ubonty

Reputation: 671

working with android 9 patch file not working

enter image description here

I have been trying to change the color of the gray that surrounds my custom tabs, I have tried looking for the answer on YouTube:

http://www.youtube.com/watch?v=IfrXE2R2nqM

http://www.youtube.com/watch?v=XMWlRXfKgtY

This helped me understand the process of 9-patch files but I must be doing something wrong for this not to work.

What I have tried doing so far:

  1. In my project I see in the "Package Explorer" I see Android 4.1, which is in ...android-sdk/platforms/android-16. I opened that with winrar, went into res/drawable-mdpi and just to see if anything would change I replaced "tab_selected.9.png" and "tab_selected_v4.9.png" with the image of "tab_pressed.9.png". I then tried to compile my project just to see the same gray for the background of my tab buttons.

  2. The current android project I am working on I placed the changed "tab_selected.9.png" and "tab_selected_v4.9.png" inside of my drawables folder and tried running it just to see the same thing.

Does anyone know what I am doing wrong, am I not compiling something or do I need to mess with different .9.png files? Or does anyone have a simple process just to change the gray color of these tabs? I guess the quick answer for me here is what would I have to do to get the image of "tab_pressed.9.png" to replace "tab_selected.9.png"

EDIT:

tab_selected.9.png

enter image description here
tab_pressed.9.png

enter image description here

Upvotes: 2

Views: 1325

Answers (2)

rgrocha
rgrocha

Reputation: 1461

Make sure the only pixels in the border are the 9-patch ones, either black (#f000 in ARGB) or fully transparent (#0000). It's a normal to left some pixels with some transparency on those pixels that gets unnoticed at simple view.

Upvotes: 1

Joe Plante
Joe Plante

Reputation: 6368

This is a little tricky. Sometimes the stuff like the grey can creep in from the underlying Android layer. Sometimes things like tabhost have views that have to be overridden. I remember having to maek a selector drawable in XML to get the tabhost to work with custom items.

Upvotes: 0

Related Questions