In 1.android, resources can be configured through XML files, such as strings, and integer pulls. Floating point number and so on, of course, you can also configure the picture resources and selectors, below we look at the configuration of several image resources.
@1 rectangular box with gradient-changing configuration code
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Border:none; "/>
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "http://schemas.android.com /apk/res/android "> <!--set black border--> <stroke Android:color= "#000" android:width= "2px"/> <!--set the gradient--> <gradient android:angle= " " android:endcolor= "#c0c0c0" android:startcolor = "#fcd209"/> <!--set margin--> <padding android:left= "5DP" android:top= " 5DP " android:right=" 5DP " android:bottom= "5DP"/></shape>
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Border:none; "/>
Look at the effect:
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/1069003/201706/ 1069003-20170625001039335-1724043223.png "style=" border:0px; "/>
@2 rectangular box with rounded corners
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "http://schemas.android.com /apk/res/android " android:shape=" Rectangle "> <!--Set Transparent background color-- > <!----> <solid android:color= "#87ceeb"/> <stroke android:width= "2px" android:color= "#000"/> <!--set four fillet radii-- > <corners android:toprightradius= "10px" android:bottomrightradius= "10px" android:topleftradius= "10px" android: bottomleftradius= "10px" /> < padding android:left= "5DP" android:right= "5DP" android:top= "5DP" android:bottom= "5DP"/></shape>
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Border:none; "/>
Look at the effect:
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/1069003/201706/ 1069003-20170624233612491-1685056686.png "style=" border:0px; "/>
@3 Oval drawable Code
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Border:none; "/>
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "Http://schemas.android.com/apk/res/android" Android:shape= "Oval" > <solid android:color= "#88005621"/> <stroke android:color= "#000000" a Ndroid:width= "2px"/> <corners android:radius= "20DP"/></shape>
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Border:none; "/>
Look at the effect:
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/1069003/201706/ 1069003-20170624234258991-955710675.png "style=" border:0px; "/>
@4 Ring Resource Code
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Border:none; "/>
<?xml version= "1.0" encoding= "Utf-8"? ><relativelayout xmlns:android= "http// Schemas.android.com/apk/res/android " xmlns:tools=" Http://schemas.android.com/tools " android:id= "@+id/activity_main" android:layout_width= "Match_ Parent " android:layout_height=" Match_parent " android: paddingbottom= "@dimen/activity_vertical_margin" android:paddingleft= "@dimen/activity_ Horizontal_margin " android:paddingright=" @dimen/activity_horizontal_margin " android:paddingtop= "@dimen/activity_vertical_margin" tools:context= " Com.market.shapedrawable.MainActivity "> <TextView android:layout_width= "Wrap_content" android: layout_height= "Wrap_content" &nbsP; android:layout_centerinparent= "true" android:padding= "100DP" android:background= "@drawable/ring" android:text= "hello world!" /></RelativeLayout>
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Border:none; "/>
Look at the effect:
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/1069003/201706/1069003-20170625000538757-21633300. PNG "style=" border:0px; "/>
@5 origin or solid Circle resource code
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Border:none; "/>
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "Http://schemas.android.com/apk/res/android" Android:shape= "Oval" > <solid android:color= "#ff2236"/> <size android:width= "10DP" Android: height= "10DP"/></shape>
650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Border:none; "/>
Look at the effect:
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/1069003/201706/ 1069003-20170625000929257-610253446.png "style=" border:0px; "/>
drawable Resources for Android