Android Custom Shape Circle button

Source: Internet
Author: User
Tags dashed line

Properties of shape:

    • Solid

Description: Internal padding

Properties: Android:color Fill Color

    • Size

Description: Size

Property:

Android:width width

Android:height High

    • Gradient

Description: Gradient Color

Property:

Android:startcolor Gradient Start Color

Android:endcolor Gradient End Color

Android:centercolor Gradient Middle Color

Android:angle the gradient angle, when angle=0, the gradient is left to right, then counterclockwise, and when angle=90, the gradient moves from the top down. Angle must be a multiple of 45.

Android:type Gradient Type: linear (linear), radial (radioactive, centered on start color), sweep (scanline gradient)

Android:userlevel set to True if you want to use the Levellistdrawable object. Set true no gradient color, false has gradient

Android:grdientradial gradient radius, this value only takes effect if the type is set to radial

Android:centerx the relative position of the X-point coordinates of the gradient center

Android:centery relative position of y-point coordinates of the gradient center

    • Stroke

Description: Stroke

Property:

Android:width Stroke width

Android:color Stroke Color

Android:dashwidth stroke style is a dashed width, a value of 0 is solid, and a value greater than 0 is a dashed line

Android:dashgap the distance between dashes when the stroke is dashed

    • Corners

Description: Rounded Corners

Property:

Android:radius Four Corner radius value

Android:topleftradius the upper left corner radius value

Android:toprightradius the upper right corner radius value

Android:bottomleftradius the lower right corner radius value

Android:bottomrightradius lower left corner radius value

    • Padding

Description: Inner margin

Property:

Android:left left inner margin

Android:right right inner margin

Android:top on the inside margin

Android:bottom lower inner margin

Instance Code

    <?xml version= "1.0" encoding= "Utf-8"?> <shape      xmlns:android= "http://schemas.android.com/apk/res/ Android ">                <corners android:radius=" 5DP "/>                <size              android:height=" 30DP "              android:width = "20DP"/>                <gradient               android:startcolor= "#9933cc"              android:endcolor= "#aa66cc"              android: angle= "              />                    <padding android:left=" 5DP "              android:right=" 5DP "              android:top=" 5DP              " android:bottom= "5DP"/>            </shape>  

<Button Android:id="@+id/btn"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:layout_below="@+id/tv_test"Android:background="@drawable/btn_shape"Android:text="Button"/>

Android Custom Shape Circle button

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.