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