2016-03-20 11 views
0

Ich muss eine dynamische Liste von Formularen erstellen. Der Benutzer könnte Daten in jedes Element der Liste eingeben (das ein editierbares Textfeld und andere Elemente enthalten würde).Beste Strategie zum Erstellen einer ListView von Formularen in Android?

Was ist der beste Ansatz? Wie würde ich auf die eingegebenen Informationen in jedem Listenelement zugreifen? Wäre jedes Listenelement ein eigenes Fragment?

Antwort

0
1) Decide what elements you need in each list item 
2) Create a data class with the member variables to how your data. one data object will be initialized per listview item //note this is not required, but it can help. 
3) Create a layout (list_view_item_layout.xml) for your listview items 
4) Declare your ListView in your layout.xml, ensure that you give it an android:id. 
5) Declare and initialize an array of your data objects (or just an array of data) that holds all the data objects that you want displayed in your list 
5) Create your MyListViewAdapter.class that extends BaseAdapter. this class will inflate your list_view_item_layout and populate the views with the data that is in your data array 
6) call ListView#setAdapter(); passing in myListViewAdfapter, context, R.id.document_list_view //I htink that is correct 

Das ist alles, was es gibt. Suchen Sie nach Tutorials für benutzerdefinierte Listenansicht Adapter, gibt es eine Milliarde + Tutorials

Verwandte Themen