The recent preparation of a set of articles on UI effects is a summary of this time, mainly about the UI effect design module in Android development. It is divided into several pages:
- Android XML Drawing (Shape, Layer, Selector)
- Android Canvas Drawing (canvas, point, porterduffxfermode, shader)
- Android Animation detailed
- Android Custom Controls
Today, as an appetizer, first talk about the simplest XML drawing, I believe that we all use more familiar, here is to do a small document, when the parameter configuration forgot, easy to access
One, Shape
<?xml version= "1.0" encoding= "Utf-8"?> <shape xmlns:android= "http://schemas.android.com/apk/res/android"/ /Here you can set shape shapes without setting defaults to rectangle android:shape=["Rectangle" | " Oval "|" Line "|"
Ring "|] > <!--fillet shape= "Rectangle" is using the default 1DP--> <corners android:radius= "XDP" xd P "android:toprightradius=" "XDP" android:bottomleftradius= "XDP" android:bottomrightradius= "XDP"/> <!--
Gradient--> <gradient android:startcolor= "color" android:centercolor= "color" android:endcolor= "color" The value of the Android:uselevel= "boolean" android:angle= "integer"//angle must be a multiple of 45 (including 0), only type= "linear" android:type=["valid linear" "|" Radial "|" Sweep "] android:centerx=" integer "android:centery=" integer "android:gradientradius=" integer "/> <!--
Separate--> <padding android:left= "XDP" android:top= "XDP" android:right= "XDP" android:bottom= "XDP"/> <!--size width and height--> <size android:width= "DP "android:height=" DP/> <!--fill--> <solid android:color= "Color"/><!--fill Colors--> t;! --Stroke--> <stroke android:width= "DP" android:color= "COLOR" android:dashwidth= "DP"//Dashed width android:d
Ashgap= "DP"/>//Dashed interval width </shape>
Second, Layer
This friend who has used Photoshop should be well understood and used to achieve layer effects
<?xml version= "1.0" encoding= "Utf-8"?> <layer-list xmlns:android=
"Http://schemas.android.com/apk/res" /android ">
<!--item1-->
<item>
<bitmap android:src=" drawable "
android:gravity = "Center"/>
</item>
<!--item2-->
<item>
<bitmap android:src= "drawable"
android:gravity= "center"/>
</item>
<!--item3-->
<item
<bitmap Android:src= "drawable"
android:gravity= "center"/>
</item>
</layer-list>
Third, Selector
This commonly used language button, CheckBox, radio, and other controls, toggle the control effect through different events
<?xml version= "1.0" encoding= "Utf-8"?> <selector xmlns:android=
"http://schemas.android.com/apk/res/" Android ">
<!--default background picture-->
<item android:drawable=" drawable "/>
<!--background picture without focus >
<item
android:state_window_focused= "false"
android:drawable= "drawable"
/>
<! --Background picture-->
<item
android:state_focused= "true"
android:state_pressed= "true" when the focus is received in non-touch mode and clicked
android:drawable= "drawable"
/>
<!--touch mode Click the background picture-->
<item
android:state_ Focused= "false"
android:state_pressed= "true"
android:drawable= "drawable"
/>
<!-- Picture background When selected-->
<item
android:state_selected= "true"
android:drawable= "drawable"
/>
<!--picture background-->
<item
android:state_focused= "true"
android:drawable= "drawable" when the focus is obtained
/>
</selector>
This is part of the UI effect design module in Android development and will continue to be updated to help you learn.