Android resource File-shape

Source: Internet
Author: User
Tags border color

    1. Solid
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" >    <!--绿色填充-->    <solid android:color="#0f0" /></shape>

2.corner

<shape xmlns:android="http://schemas.android.com/apk/res/android" >    <solid android:color="#0f0" />    <!--半径为10px的圆角-->    <corners android:radius="10px" /></shape>

3.gradient

<shape xmlns:android="Http://schemas.android.com/apk/res/android" >    <solid android:color="#0f0" />    <corners Android:radius="10px" />     <!--gradient: start color, middle color, end color--    <gradientandroid:startcolor="#D8FC83"android:centercolor= "#41F114" Android:endcolor="#0f0" />                        </shape>

4.stroke

<shape xmlns:android="Http://schemas.android.com/apk/res/android" >    <solid android:color="#0f0" />    <corners Android:radius="10px" />    <gradientandroid:centercolor="#41F114"android:endcolor= "#0f0" Android:startcolor="#D8FC83" />                            <!--border: width, color--    <strokeandroid:width="1px"android:color="#f0f" />                </shape>

5. Shadow effect

Requires 3 layers: A: Bottom and overall background color consistent B: middle layer left and top staggered 2DPC: Top and shadow color of the same border, and the bottom of the same color of the fill color, bottom and right direction stagger 2DP<?xml version= "1.0" encoding= "Utf-8"?><layer-list xmlns:android="Http://schemas.android.com/apk/res/android" >    <!--The bottom ---    <item>        <shape>            <solid android:color="#fff" />        </shape>    </Item>  <!--Middle ---    <itemandroid:left="2DP"android:top="2DP">                         <shape>            <solid android:color="#ccc" />        </shape>    </Item>  <!-- Top---    <itemandroid:bottom="2DP"android:right="2DP">                         <shape>            <solid android:color="#fff" />            <strokeandroid:width="1px"android:color="#ccc" />                                        </shape>    </Item></layer-list>

6. The bottom border color differs from other border colors.
–>–>

A: the lowest yellow fill color. B: Middle layer gray border 1px, white fill color, bottom 5px, can reveal 5px bottom yellow. C: Top left,right,top transparent border 1px, white fill color, just show the middle layer of the left,right,top border. Bottom 4px just covers the bottom border of the middle layer.<?xml version= "1.0" encoding= "Utf-8"?><layer-list xmlns:android="Http://schemas.android.com/apk/res/android" > <!--First floor --    <item>        <shape>            <solid android:color="#ff0" />        </shape>    </Item><!--second floor --    <item android:bottom="5px">        <shape>            <solid android:color="#fff" />            <strokeandroid:width="1px"android:color="#ccc" / >                                        </shape>    </Item>To remove the bottom gray border, overlay a layer. (white background, transparent border, and the width of the second border is basically the same, but the value of bottom must be less than the bottom value of the second layer)<!--third floor --    <itemandroid:bottom="4px"android:left="1px"android: right ="1px"android:top="1px">                                        <shape>            <solid android:color="#fff" />            <strokeandroid:width="1px"android:color="#0000" />                                        </shape>    </Item></layer-list>

Android resource File-shape

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.