This article directly and selectively translates the official development guide
=============================
There are 10 types of drawable, as follows
-Bitmap file: This is simple, you can also use XML to define more detailed, first press do not write ....
-Nine-patch File: This is a custom bloom area of the bitmap, generally with. 9.png suffix, may be generated with sdk/tools/draw9patch.bat, in fact, the tool in the outer edge of the picture to add a one-pixel border to mark " Zoom area ", as follows
After adjusting, you will get this effect:
-Layer List: A multi-level drawable that is drawn to the screen sequentially:
<?XML version= "1.0" encoding= "Utf-8"?><layer-listxmlns:android= "Http://schemas.android.com/apk/res/android"> <Item> <Bitmapandroid:src= "@drawable/android_red"android:gravity= "Center" /> </Item> <ItemAndroid:top= "10DP"Android:left= "10DP"> <Bitmapandroid:src= "@drawable/android_green"android:gravity= "Center" /> </Item> <ItemAndroid:top= "20DP"Android:left= "20DP"> <Bitmapandroid:src= "@drawable/android_blue"android:gravity= "Center" /> </Item></layer-list>
The effect is as follows:
-State List: is based on the status of the drawable to determine which drawable to display, such as a button has (pressed, focused, niether) various states.
Examples are as follows:
<?XML version= "1.0" encoding= "Utf-8"?><selectorxmlns:android= "Http://schemas.android.com/apk/res/android"> <Itemandroid:state_pressed= "true"android:drawable= "@drawable/button_pressed" /> <!--pressed - <Itemandroid:state_focused= "true"android:drawable= "@drawable/button_focused" /> <!--focused - <Itemandroid:state_hovered= "true"android:drawable= "@drawable/button_focused" /> <!--hovered - <Itemandroid:drawable= "@drawable/button_normal" /> <!--default -</selector>
Summary of the drawable of Android-resource