Android Button Set Border instance

Source: Internet
Author: User

The following button label is an example:

Here is the link to the label <shape>, set the background style, border, gradient, fillet, etc., the use of various effects see the following code

Drawable folder creates a new Buttonstyle.xml with the following contents

1 <?XML version= "1.0" encoding= "Utf-8"?>  2 <Shapexmlns:android= "Http://schemas.android.com/apk/res/android">  3     <GradientAndroid:startcolor= "#c0000000"Android:endcolor= "#c0000000"Android:angle= "All" /><!--background color gradient angle to gradient angle -  4     <SolidAndroid:color= "#00ffffff" /><!--Background Fill Color -  5     <StrokeAndroid:width= "3DP"Android:color= "#ff000000" /><!--stroke, Border width, color -  6     <CornersAndroid:radius= "10DP" /><!--radius of Corner arc -  7     <paddingAndroid:left= "3DP"Android:top= "3DP"Android:right= "3DP"Android:bottom= "3DP" /><!--A blank space left around -  8 </Shape>  

Then, in the button, refer to the following:

< Button        Android:id = "@+id/button"        android:layout_width= "Wrap_content"       android:layout_height= "Wrap_ Content "       android:text=" button "       android:background=" @drawable /buttonstyle "/>

Reference: http://blog.csdn.net/mj19910923/article/details/8633255

Android Button Set Border instance

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.