Android Layer-list properties and use specific explanations

Source: Internet
Author: User
Tags knowledge base

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.