Color Resources
<span style= "FONT-SIZE:18PX;" ><resources> <color name= "Red" > #f00 </color> <color name= "green" > #0f0 </ color> <color name= "Blue" > #00f </color></resources></span>
Size Resources
<span style= "FONT-SIZE:18PX;" ><resources> <dimen name= "DP10" >10dp</dimen> <dimen name= "SP10" >10sp</ Dimen></resources></span>
Array Resources
<span style= "FONT-SIZE:18PX;" ><resources> <string-array name= "Stringarray" > <item>Hello</item> < item>world</item> </string-array> <integer-array name= "Integerarray" > <item >1</item> <item>2</item> <item>3</item> </integer-array> </resources></span>
you can refer directly to the layout file in the ListView
<span style= "White-space:pre" ></span><span style= "font-size:18px;" >android:entries= "@array/stringarray" </span>
drawable ResourcesTo modify a picture using the nine grid tool
Open the Draw9patch in the Tools folder under the SDK and drag into the original image
Drag the nine Gongge lines on the four edge to determine the zoom area of the picture, Ctrl+s Save As. 9.png formatdifferent states of the Make button
New drawable folder under Res, new XML file, select Selector label
<span style= "FONT-SIZE:18PX;" ><selector xmlns:android= "Http://schemas.android.com/apk/res/android" > <item android:drawable= "@ Drawable/btn_pressed "android:state_pressed=" true "></item> <item android:drawable=" @drawable/btn "Android:state_pressed=" false "></item></selector></span>
under button, set the background
<span style= "White-space:pre" ></span><span style= "font-size:18px;" >android:background= "@drawable/btn_bg" </span>
Style Resources
<span style= "FONT-SIZE:18PX;" > <style name= "MyText" > <item name= "android:textsize" >20pt</item> <item name= "Android:textcolor" > #00f </item> </style></span>
Topic Resources
using System-Customized themes
Under the Application or Activity tab
<span style= "White-space:pre" ></span><span style= "font-size:18px;" >android:theme= "@android: Style/theme.black" </span>
Menu ResourcesFile Configuration
Res folder under the Menu folder under the Main.xml file configuration
<span style= "FONT-SIZE:18PX;" ><menu xmlns:android= "Http://schemas.android.com/apk/res/android" > <item android:id= "@+id/ MenuItem1 " android:orderincategory=" " android:title=" AAA "/> <item android:id=" @+id/ MenuItem2 " android:icon=" @drawable/ic_launcher " android:orderincategory=" android:title= " BBB" /></menu></span>
Calling Methods
<span style= "FONT-SIZE:18PX;" > @Overridepublic boolean oncreateoptionsmenu (Menu menu) {//TODO auto-generated Method Stubgetmenuinflater (). Inflate (R.menu.main, menu); return Super.oncreateoptionsmenu (menu);} </span>
Listening for menu events
<span style= "FONT-SIZE:18PX;" > @Overridepublic boolean onoptionsitemselected (MenuItem item) {switch (Item.getitemid ()) {case R.ID.MENUITEM1: Toast.maketext (This, "menuItem1", Toast.length_short). Show (); Break;case R.id.menuitem2:toast.maketext (This, " MenuItem2 ", Toast.length_short). Show (); break;default:break;} return super.onoptionsitemselected (item);} </span>
parsing of raw XML files
File Structure
<span style= "FONT-SIZE:18PX;" ><?xml version= "1.0" encoding= "UTF-8"?><users> <user name= "Zhang" age= "/> <user" Name= "Li" age= "/></users></span>"
parsing Process
</pre><pre name= "code" class= "java" ><span style= "font-size:18px;" >xmlresourceparser parser=getresources (). GETXML (r.xml.users); try {while (Parser.geteventtype ()! = Xmlpullparser.end_document) {if (Parser.geteventtype () ==xmlresourceparser.start_tag) {if (Parser.getname (). Equals ( "User") {String name=parser.getattributevalue (null, "name"); String age=parser.getattributevalue (NULL, "age"); System.out.println (String.Format ("Name:%s, Age:%s", name,age));}} Parser.next ();}} catch (Xmlpullparserexception e) {//Todo auto-generated catch Blocke.printstacktrace ();} catch (IOException e) {//Todo A Uto-generated catch Blocke.printstacktrace ();} </span>