Are there conventions on how to name resources?
I don't know whether there are any official recommendations.
For ids in my layouts with widgets and containers, I use the convention:
<layout>_<widget/container>_<name>
I do the same strategy for any dimens, strings, numbers, and colors I use in those layouts. However, I do try generalizing. e.g if all buttons have a common textColor, I won't prefix the name with the layout. The resource name would be 'button_textColor'. If all textColors are using the same the resource it will be named 'textColor'. For Styles, this is usually the case as well.
For menu resources i use:
menu_<activity>_<name>
Animations are only different as you cannot use uppercase letters. Same goes for drawable xml resources, i believe.
Taken from Android's documentation. There is more there on the subject.
Android SDK will be a good place to start.
For example, I try to scope IDs within the activity.
If I had a ListView
it simply would be @android:id/list
in all the activities.
If, however, I had two lists then I would use the more specific @id/list_apple
and @id/list_orange
So generic (ids, ...) gets reused in the R.java file
while the unique ones (sometimes gets reused) get prefixed with generic ones separated by an underscore.
The underscore is one thing, I observed, for example:
Layout width is layout_width
in xml and layoutWidth
in code, so I try to stick to it as list_apple
So a Login button will be login
, but if we have two logins then login_foo
and login_bar
.