Resource <Resources>
Resource
A Drawable is a general concept of a graphic object that can be displayed on the screen and which you can get using an API, for example getDrawable(int) , or apply to another XML resource with attributes such as android:drawable and android:icon . There are several different types of drawings:
A bitmap file, a bitmap image file (.png, .jpg or .gif), creates a BitmapDrawable .
Nine-Patch File, A PNG file with stretch areas to allow image resizing based on content (.9.png), creates a NinePatchDrawable .
A list of layers, A Drawable , which manages an array of other Drawable s. They are drawn in array order, so the element with the highest index is drawn above, creates a LayerDrawable .
A list of states, an XML file that refers to different raster graphics for different states (for example, to use a different image when a button is clicked) creates a StateListDrawable .
The list of levels, XML , which defines Drawable , which manages several alternative Drawable s, each of which assigns a maximum numerical value, creates a LevelListDrawable .
Transable Drawable, an XML file that defines a Drawable that can cross-fade between two Drawable resources, creates a TransitionDrawable .
Drawable insert, an XML file that defines a Drawable that inserts another Drawable at a specified distance. This is useful when a View needs a background Drawble that is smaller than viewing the actual borders.
Clip Drawable, an XML file that defines a Drawable that will copy another Drawable based on this value of the current Drawable level, creates a ClipDrawable .
A scalable Drawable, an XML file that defines a Drawable that resizes another Drawable based on its current level value, creates a ScaleDrawable .
Shape Drawable, an XML file that defines a geometric shape, including colors and gradients, creates a ShapeDrawable .
Also see the Animation Resource document for creating an AnimationDrawable .
Note. The color resource can also be used as Ddrawable in XML . For example, when creating StateListDrawable you can refer to the color resource for the android:drawable ( android:drawable="@color/green" ).
Raster
Bitmap image. Android supports bitmap files in three formats: .png (preferred) ,. jpg (acceptable) ,. gif (discouraged).
You can directly reference the bitmap file using the file name as the resource identifier or create an alias resource identifier in XML.
Note. Raster files can be automatically optimized during lossless compression using the aapt tool during the build process. For example, PNG with a true color that does not require more than 256 colors can be converted to an 8-bit PNG with a color palette. This will result in image quality, but less memory is required. Therefore, be aware that binary image files located in this directory may change during assembly. If you plan to read the image as a bitstream to convert it to a bitmap, put the images in the res/raw/ folder where they will not be optimized.
Misbah Farooqi Mar 28 '15 at 16:13 2015-03-28 16:13
source share