When localizing different types of resources are required, each of which has its own home in the android project structure.
Following are the different directories that we can place under the \res
directory. The resource types placed in each of these directories are explained in the table below:
Directory | Resource Type |
---|---|
animator/ | XML files that define property animations. |
anim/ | XML files that define tween animations. (Property animations can also be saved in this directory, but the animator/ directory is preferred for property animations to distinguish between the two types.) |
color/ | XML files that define a state list of colors. See Color State List Resource |
drawable/ | "Bitmap files (.png, .9.png, .jpg, .gif) or XML files that are compiled into the following drawable resource subtypes: : Bitmap files - Nine-Patches (re-sizable bitmaps) - State lists - Shapes - Animation drawables - Other drawables - " |
mipmap/ | Drawable files for different launcher icon densities. For more information on managing launcher icons with mipmap/ folders, see Managing Projects Overview. |
layout/ | XML files that define a user interface layout. See Layout Resource. |
menu/ | XML files that define application menus, such as an Options Menu, Context Menu, or Sub Menu. See Menu Resource. |
raw/ | Arbitrary files to save in their raw form. To open these resources with a raw InputStream, call Resources.openRawResource() with the resource ID, which is R.raw.filename. |
However, if you need access to original file names and file hierarchy, you might consider saving some resources in the assets/ directory (instead ofres/raw/). Files in assets/ are not given a resource ID, so you can read them only using AssetManager. | |
values/ | XML files that contain simple values, such as strings, integers, and colors, as well as styles and themes |
xml/ | Arbitrary XML files that can be read at runtime by calling Resources.getXML(). Various XML configuration files must be saved here, such as a searchable configuration. |