Sunday, May 15, 2011

Not public ressources

When creating the graphics of my application, I like to reuse as much as I can the resources already provided by the Android framework. This allows my application to match as much as possible the already established graphic design of the platform. However, a lot of these resources are tagged as private.

In order to be able to use them without any compatibility issue, one need to make a local copy of the relevant file in its own project. However, in the early stage of the graphic design, I like to try different approach and I find it time consuming to copy all the 9.png and xml in my project. To avoid doing that, you can use the *android to access private resources.



Here, I'm using the private android transparent drawable as the background of my button. I can then check the result and see if I like it or not before copying the relevant files.

Note that in this case, it would be better to use a custom style that inherit from Widget.Button.Transparent.


  




This way, the resource files doesn't need to be duplicated.

No comments:

Post a Comment