<?xml version= "1.0" encoding= "Utf-8"?><resources> <string name= "App_name" >xxx</string> &L T;string name= "Navigation_drawer_open" >open navigation drawer</string> <string name= "Navigation_drawer_ Close ">close navigation drawer</string> <string name=" Action_example ">example action</string> & Lt;string name= "action_settings" >Settings</string> Zhao Archive QQ463431476 <string-array name= "sections" > <item>xxx</item> </string-array><string-array name= "Section_titles" > <item>xxx</ item> </string-array><string-array name= "sections_icons" > <item> @drawable/see</item> &l t;item> @drawable/settings</item> <item> @drawable/figure</item> <item> @drawable/wifi </item> <item> @drawable/mic</item> <item> @drawable/voice</item></string-array >
http://www.cnblogs.com/xiaobo-Linux/QQ463431476
http://www.cnblogs.com/xiaobo-Linux/
public void onsectionattached (int number) { //title string[] Stringarray = Getresources (). Getstringarray ( R.array.section_titles); Mtitle = stringarray[number-1]; Switch (number) {case 1: Getsupportfragmentmanager (). BeginTransaction () . Replace (R.id.container, new Robot ()). commit (); break; }
//Data adapter final TypedArray TypedArray = Getresources (). Obtaintypedarray (r.array.sections_icons); Mdrawerlistview.setadapter (New Arrayadapter<String>(Getactionbar (). Getthemedcontext (), Android. R.layout.simple_list_item_activated_1, Android. R.id.text1, Getresources (). Getstringarray (r.array.sections)) {@Override Publ IC view GetView (int position, view Convertview, ViewGroup parent) {View V = super.getview (position, conver TView, parent); int resourceId = Typedarray.getresourceid (position, 0); drawable drawable = Getresources (). getdrawable (ResourceId); ((TextView) v). Setcompounddrawableswithintrinsicbounds (drawable, NULL, NULL, NULL); return v; } });
@android:d Rawable/xxx is the image that comes with the SDK Android system
C:\Program Files (x86) \android\sdk\platforms\android-15\data\res\drawable-xhdpi
Android nagative drawer icon with title