1.Bitmap
<? XML version= "1.0" encoding= "Utf-8" ?> < xmlns:android= "http://schemas.android.com/apk/res/android" android:src = "@mipmap/ic_launcher" > </ Bitmap >
2.shape
<?XML version= "1.0" encoding= "Utf-8"?><Shapexmlns:android= "Http://schemas.android.com/apk/res/android"Android:shape= "Rectangle"><!--shape has rectangle (rectangle), oval (oval), line (straight), Ring (ring) - <!--corners used when shape is rectangle, default is 1DP - <CornersAndroid:bottomleftradius= "1DP"Android:bottomrightradius= "1DP"Android:radius= "1DP"Android:topleftradius= "1DP"Android:toprightradius= "1DP" /> <!--Gradient Gradient - <GradientAndroid:angle= "integer"Android:centercolor= "Color"Android:centerx= "integer"Android:centery= "integer"Android:endcolor= "Color"Android:gradientradius= "integer"Android:startcolor= "Color"Android:type= "Linear/radial/sweep"Android:uselevel= "Boolean" /> <paddingAndroid:bottom= "1DP"Android:left= "1DP"Android:right= "1DP"Android:top= "1DP" /> <!--the size is specified in sizes, and is typically used with the ImageView Mate ScaleType Property - <sizeAndroid:width= "integer"Android:height= "integer"/> <!--Solid Fill Color - <SolidAndroid:color= "Color"/> <!--stroke Specifies border dashwidth: Dashed width dashgap: Dash interval width - <StrokeAndroid:color= "Color"Android:width= "integer"Android:dashwidth= "integer"Android:dashgap= "integer" /></Shape>
3.layer Layer Overlay
<?XML version= "1.0" encoding= "Utf-8"?><layer-listxmlns:android= "Http://schemas.android.com/apk/res/android"> <Itemandroid:drawable= "@mipmap/ic_launcher" /> <ItemAndroid:bottom= "10DP"android:drawable= "@mipmap/ic_launcher"Android:left= "10DP"Android:right= "10DP"Android:top= "10DP" /></layer-list>
4.Selector
<?XML version= "1.0" encoding= "Utf-8"?><selectorxmlns:android= "Http://schemas.android.com/apk/res/android"> <!--background picture by default - <Itemandroid:drawable= "@mipmap/ic_launcher" /> <!--background picture When there is no focus - <Itemandroid:drawable= "@mipmap/ic_launcher"android:state_window_focused= "false" /> <!--background image when clicked in non-touch mode - <Itemandroid:drawable= "@mipmap/ic_launcher"android:state_focused= "true"android:state_pressed= "true" /> <!--background picture when clicked in touch mode - <Itemandroid:drawable= "@mipmap/ic_launcher"android:state_focused= "false"android:state_pressed= "true" /> <!--background picture When selected - <Itemandroid:drawable= "@mipmap/ic_launcher"android:state_selected= "true" /> <!--background picture when getting focus - <Itemandroid:drawable= "@mipmap/ic_launcher"android:state_focused= "true" /></selector>
Usually, it can be combined.
Android XML Drawing p113-p117