Haha bo master recently only to broadcast, write some blog to spend time by the way to summarize the knowledge, things are more basic hope to improve each other
--------------------------------------------------------------------------------------------------------------- ----
ListView is a commonly used Android control with a variety of adapter used (Arrayadapter, Sampleadapter, CursorAdapter, and auto to adapter, etc.)
1. Create a new Android app
2. Pull a ListView control into the View interface
Public classMainactivityextendsActivity {PrivateListView LV;PrivateArraylist<string> Al =NewArraylist<string>(); @Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); Setcontentview (R.layout.activity_main); SetData (); } Private voidSetData () {Al.add (A); Al.add ("B"); Al.add (C); Al.add ("D");//Add Datalv= (ListView) Findviewbyid (R.ID.LISTVIEW1);//Building a ListView object from XML with IDArrayadapter<string> aa=NewArrayadapter<string> ( ThisAndroid. R.layout.simple_list_item_1,al);//building the Adapter objectlv.setadapter (AA); }}
A simple listview will show up.
Android Basics explained-listview_arrayadapter