22

First I thought that I could find this list on the net, but I'm either looking for the wrong term or such list doesn't exist.

What I need is basically a cheat sheet of all predefined resource folders in an Android project. For example, a list could say something like this

  • res/drawable - all graphics go here
  • res/drawable-hdpi - all graphics of higher resolution go here
  • res/layout - some-meaningful-description
  • res/values - some-meaningful-description
  • res/layout-land - some-meaningful-description
  • etc.

I am really surprised that such list isn't easily found on the net. Whenever I need to add some resource I haven't used before, I have to look on the net for the correct naming (and I would rather look at the list of res folders).

sandalone
  • 41,141
  • 63
  • 222
  • 338
  • 2
    Have you checked http://developer.android.com/guide/topics/resources/available-resources.html. For each folder you can use combinations of the following tags small, normal, large, xlarge, nodpi, hdpi, mdpi, ldpi, xhdpi, land, port, long, notlong, and others. – Ray Britton Jan 21 '11 at 17:07

3 Answers3

47

Taken from here:

In the /res folder you can have:

  • animator/ -XML files that define property animations.

  • anim/ - XML files that define tween animations

  • color/ - XML files that define a state list of colors.

  • drawable/ - Bitmap files / Nine-Patches (re-sizable bitmaps) / State lists / Shapes / Animation drawables / Other drawables

  • layout/ - XML files that define a user interface layout.

  • menu/ - XML files that define application menus, such as an Options Menu, Context Menu, or Sub Menu.

  • raw/ - Arbitrary files to save in their raw form.

  • values/ - XML files that contain simple values, such as strings, integers, and colors.

    • arrays.xml for resource arrays (typed arrays).
    • colors.xml for color values
    • dimens.xml for dimension values.
    • strings.xml for string values.
    • styles.xml for styles.
  • xml/ - Arbitrary XML files

Also see Accessing Alternative Resources for more specific device configurations (locale, dpi, size, aspect, orientation, etc)

BrokenBinary
  • 7,731
  • 3
  • 43
  • 54
f20k
  • 3,106
  • 3
  • 23
  • 32
  • If you provide internationalisation (i18n) in your app, with the exception of `strings.xml` which MUST be added to each directory where a language other than English is supported (e.g. values-ca, values-vi, etc), all other resource files under **values** directory DO NOT need to be replicated / copied across the different **values** directory. These resource files are: `arrays.xml`, `colors.xml`, `dimens.xml` and `styles.xml`. – ChuongPham Nov 15 '13 at 14:51
  • @ChuongPham: Pretty sure the individual filenames are arbitrary. The documentation only mentions "strings.xml" in the "example" section. http://developer.android.com/guide/topics/resources/string-resource.html – Mooing Duck Aug 28 '15 at 05:04
0

It should be noted that these folder layouts are not written in stone. One can create a folder tree in whatever manner one chooses. This is just the default tree created with IDEs such as Eclipse and is, as a result, the most popular and often consistent format. If you find another format to fit you better then you are free to use it. Just reference properly in your code.

Aaron Ratner
  • 111
  • 3
0

Never thought about it, but you are right. You can always create a new project based on available samples projects in eclipse and see they have chosen to organize it.

You can see how one of my project is organized. my project in eclipse

theAlse
  • 5,577
  • 11
  • 68
  • 110