Shape of android:res make fillets, dashes, gradients

Source: Internet
Author: User

XML Control Configuration Properties

android:background= "@drawable/shape"

Label

Corners----------Rounded Corners
Gradient----------Gradients
Padding----------content distance from boundary
Size------------Sizes
Solid----------Fill Color
Stroke----------Strokes

Note that the Corners property is Bottomleftradius to the lower-right corner and Bottomrightradius to the lower-left corner.

Shape to make rounded corners

<button     android:layout_width= "160DP"    android:layout_height= "Wrap_content"  Android:background= "@drawable/button_shape" android:text/>      
<?XML version= "1.0" encoding= "Utf-8"?><ShapeXmlns:android= "Http://schemas.android.com/apk/res/android"><SolidAndroid:color= "#fff"/><padding android: Top= "10px"  Android:bottom = "10px" /> << Span style= "color: #800000;" >corners android:radius= "16px" /> <stroke android:width= "1px"  Android:color= "#000" /></>           

Shape making dashed lines

Solid Line without Dashgap property

<View     android:layout_width= "Match_parent"    android:layout_height= "5px"  Android:layout_margintop= "10DP" android:background/>       
<?XML version= "1.0" encoding= "Utf-8"?><ShapeXmlns:android= "Http://schemas.android.com/apk/res/android"  Android:shape=" line " > <stroke  Android:dashgap= "3DP"  Android:dashwidth= "8DP"  Android:width=" 1DP "  Android:color=" #63a219 " /> <size android:height= "1DP" /> </shape>  

Shape making gradients

<View     android:layout_width= "Match_parent"    android:layout_height= "50DP"  Android:layout_margintop= "10DP" android:background/>       
 <? XML version= "1.0" encoding= "Utf-8" ?><shape xmlns:android= "http://schemas.android.com/ Apk/res/android "> < gradient android:angle = "270.0"  Android:endcolor = "#ffffff"  Android:startcolor = "#000000" /></ shape>        

Shape of android:res make fillets, dashes, gradients

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.