In the previous video tutorial we introduced the ASP. NET Intermediate tutorial, today to introduce the "dissemination of the smart-guest ASP." NET is a Microsoft-led Enterprise Web application development technology platform, is one of the most popular web development technology, can develop a variety of complex features of the site.
Asp. NET, also known as asp+, is not only the simple upgrade of ASP, but the new generation scripting language introduced by Microsoft Corporation. Asp. NET Framework-based Web development platform, not only absorbed the previous version of ASP's greatest advantages and reference to Java, VB language development advantages to add a lot of new features, but also fixed the previous ASP version of the operation error.
Video playback address: http://www.php.cn/course/637.html
The difficulty of this video is LISTVEIW learning:
The display of a list requires three elements:
1. Listveiw The view used to display the list.
2. The adapter is used to map data to mediations on the ListView.
3. The data is specific to the string, picture, or base component that will be mapped.
Based on the list of adapter types, the list is divided into three types, arrayadapter,simpleadapter and Simplecursoradapter
One of the easiest arrayadapter to display is a single line of words. Simpleadapter has the best extensibility and can customize various effects. Simplecursoradapter can be considered as a simple combination of the Simpleadapter database, can be in the aspect of the contents of the database as a list of the form of display.
Let's start with the simplest listview:
/** * @author Allin * */public class Mylistview extends Activity { private listview listview; Private list<string> data = new arraylist<string> (); @Override public void OnCreate (Bundle savedinstancestate) { super.oncreate (savedinstancestate); ListView = New ListView (this); Listview.setadapter (New arrayadapter<string> (this, Android. R.layout.simple_expandable_list_item_1,getdata ())); Setcontentview (ListView); }
Private List<string> GetData () { list<string> data = new arraylist<string> (); Data.add ("test data 1"); Data.add ("Test Data 2"); Data.add ("test Data 3"); Data.add ("test data 4"); return data;} }
The above code uses Arrayadapter (context context, int Textviewresourceid, list<t> objects) to assemble the data, To assemble this data requires an adapter that connects the ListView object and array data to fit the two, and the Arrayadapter construct requires three parameters, the this, and the layout file (note here that the layout file describes the layout of each row of the list, Android. R.layout.simple_list_item_1 is a system-defined layout file that displays only one line of text, a data source (a list collection). At the same time use Setadapter () to complete the final work of adaptation.