Android Shape drawable Landscaping fillet graphics

Source: Internet
Author: User

Sharedrawable Resources

Sharedrawable data is used to define a basic collection graph, which is defined in the XML resource file using the <shap.../> root element definition, using the Android:shape attribute to define the collection graphics class shape. Sharedrawable can define several shapes such as rectangles, circles, ellipses, and linear lines.

Here's an example:

In the Shape_textview.xml file:

  1  <?xml version=" 1.0 "encoding=" Utf-8 "?>  <shape xmlns:android=" Http://schemas.android.com/apk/res/android " 3  android:shape= "rectangle" > 4  <gradient android:startcolor=" #FFFF0000 " 5  android:endcolor=" #80FF00FF " 6 android:angle= "/>  8  <padding android:left= "7DP"  android:top=" 7DP "10  android:right= "7DP" 11  android:bottom= "7DP"/>12  <corners android:radius= "8DP"/>13  </shape> 

In the Main_activity.xml file:

1<relativelayout xmlns:android= "Http://schemas.android.com/apk/res/android"2Xmlns:tools= "Http://schemas.android.com/tools"3Android:layout_width= "Match_parent"4android:layout_height= "Match_parent"5android:paddingbottom= "@dimen/activity_vertical_margin"6android:paddingleft= "@dimen/activity_horizontal_margin"7android:paddingright= "@dimen/activity_horizontal_margin"8android:paddingtop= "@dimen/activity_vertical_margin"9Tools:context= ". Mainactivity ">Ten  One<TextView AAndroid:layout_width= "Fill_parent" -android:layout_height= "Wrap_content" -android:background= "@drawable/shape_textview" theandroid:text= "@string/hello_world"/> -  -</RelativeLayout>

Operation Result:

Android Shape drawable Landscaping fillet graphics

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.