The properties of Android layer-list and use specific explanations. Layer-list is used to stack multiple layers of the display, this feature can do some special effects (such as: shadows, the following effects, etc.), can also be opportunistic.
1. Code slices
<?xml version= "1.0" encoding= "Utf-8"? ><layer-list xmlns:android= "http://schemas.android.com/apk/res/ Android > <!--Recent projects require multiple layers stacked together to study layer-list in Android. The Layer-list in Android is used to display multiple layers stacked. - <item> <shape > <!--the first layer is blue-- <solid android:color= "@color/blue"/> </shape> </item> <!--the color of the second layer. That is the topmost layer, because the second layer moves two dp from the bottom of the view, so the first layer reveals a DP of black so it gives a semblance of a bottom border--- <item android:bottom= " 2dip > <shape> <solid android:color= "@color/white"/> </shape> </ Item></layer-list>
2. Layout code and (be sure to note the use of Radiogroup to remember the write RadioButton ID, otherwise cannot switch )
<radiogroup android:id= "@+id/rg" android:layout_below= "@id/bt2" android:layout_margin= "10dip" Android:layout_width= "Match_parent" android:layout_height= "wrap_content" android:orientation= "Horizo Ntal "> <radiobutton android:id=" @+id/rb0 "android:layout_height=" Wrap_content " Android:layout_width= "0dip" android:layout_weight= "1" android:button= "@null" android:text= "category" Android:checked= "true" android:gravity= "center" android:textcolor= "@color/black" android:background= "@drawable/ch_bg" android:layout_margintop= "2dip" android:paddingbottom= "4dip"/> <radio Button android:id= "@+id/rb1" android:layout_height= "wrap_content" android:layout_width= "0dip" android:layout_weight= "1" android:text= "category" Android:button= "@null" android:gravity= "center" a Ndroid:textcolor= "@color/black "android:background=" @drawable/ch_bg "android:layout_margintop=" 2dip "android:paddingbottom=" 4 Dip "/> </RadioGroup>
Selector Selector
<?XML version= "1.0" encoding= "Utf-8"? ><selector xmlns:android= "Http://schemas.android.com/apk/res/android" > <item android:state_checked= "true" android:drawable= "@drawable/bg_li" ></item> <item Android:state_checked= "false" android:drawable= "@color/white" ></item></selector>
3. Code slices
<?xml version= "1.0dip" encoding= "Utf-8"? ><layer-list xmlns:android= "http://schemas.android.com/apk/res/ Android "> <item> <bitmap android:src=" @drawable/ic_launcher " android:gravity=" center "/ > </item> <item android:left= "10dip" android:top= "10dip" > <bitmap android:src= "@ Drawable/ic_launcher " android:gravity=" center "/> </item> <item android:left=" 20dip " android:top= "20dip" > <bitmap android:src= "@drawable/ic_launcher" android:gravity= "center"/> </item> <item android:left= "30dip" android:top= "30dip" > <bitmap android:src= "@ Drawable/ic_launcher " android:gravity=" center "/> </item></layer-list>
4. Code slices
<?xml version= "1.0" encoding= "Utf-8"? ><layer-list xmlns:android= "http://schemas.android.com/apk/res/ Android "> <item android:drawable=" @drawable/ic_launcher "></item> <item android:left=" 10dip "android:top=" 10dip "android:drawable=" @drawable/ic_launcher "></item> <item android:left=" 20dip "android:top=" 20dip "android:drawable=" @drawable/ic_launcher "></item> <item android:left=" 30dip "android:top=" 30dip "android:drawable=" @drawable/ic_launcher "></item></layer-list>
5. Knowledge Base Connection:
http://blog.csdn.net/brokge/article/details/9713041
Http://www.aitinan.com/4004.html
Http://www.cnblogs.com/tsoorr/p/3407935.html
Http://www.cnblogs.com/ithouge/articles/ithouge-android-layer-list-shape-corners.html
Http://www.linuxidc.com/Linux/2012-05/59827.htm
Properties and use specific explanations for Android layer-list