One, resource naming
Resource naming conforms to Java variable naming conventions
The file name or variable name of a homogeneous resource cannot be duplicated
ADT does not consider the extension name of the resource file when generating the ID
So you can't have the same file name, expand the name of different files
Second, access to resources
A,@[package]type/name
@ is the type of resource reference, package is the name of the bundle where the resource resides
Type resource types, allowable values are: Layout,value,drawable,string,color,menu,raw and XML, etc.
b, referencing system resources
@android: Type/name
Android:textcolor= "@android: color/opaque_red"
Resource access in the C,r.java
R,type.name
You can also add the package name to Android in front of R
Third, common types of resource access
1) String
Visit: @string/name
There is a special symbolic need to use "" and use the escape character
If you need to include dynamic parameters in a string resource, you need to use "%* $s" as a placeholder for the parameter, where * represents the number of the parameter
Reference timing requires the format method of string
2) Dimension
Dimension used to define the size and dimensions of a component
The file in the XML is declared in the following way:
<resources>
<dimen name= "name" > Size </dimen>
</resources>
Access style and layout are similar
3) drawable
The drawable resource is an abstraction of the drawing object to draw, and the drawing object is obtained by getdrawable (int id)
Several major drawable images:
Bitmap: A file with a Bitmap image
Nine-patch: A PNG file with a scaling area that can be based on content scaling objects
StateList: An XML file that references different bitmap objects for different states
Ps:android specifically defines a resource bit nine_patch image, which can be scaled automatically as a background, thus greatly saving memory
4) Color
Defined in a similar way
5) Shape
Used to define a drawing object
6) etc.
Resource management for Android