1 Widget _myListView(BuildContext context) {
2
3 // backing data
4 final europeanCountries = ['Albania', 'Andorra', 'Armenia', 'Austria',
5 'Azerbaijan', 'Belarus', 'Belgium', 'Bosnia and Herzegovina', 'Bulgaria',
6 'Croatia', 'Cyprus', 'Czech Republic', 'Denmark', 'Estonia', 'Finland',
7 'France', 'Georgia', 'Germany', 'Greece', 'Hungary', 'Iceland', 'Ireland',
8 'Italy', 'Kazakhstan', 'Kosovo', 'Latvia', 'Liechtenstein', 'Lithuania',
9 'Luxembourg', 'Macedonia', 'Malta', 'Moldova', 'Monaco', 'Montenegro',
10 'Netherlands', 'Norway', 'Poland', 'Portugal', 'Romania', 'Russia',
11 'San Marino', 'Serbia', 'Slovakia', 'Slovenia', 'Spain', 'Sweden',
12 'Switzerland', 'Turkey', 'Ukraine', 'United Kingdom', 'Vatican City'];
13
14 return ListView.builder(
15 itemCount: europeanCountries.length,
16 itemBuilder: (context, index) {
17 return ListTile(
18 title: Text(europeanCountries[index]),
19 );
20 },
21 );
22
23 }
1lvRegAnimals.View = View.Details;
2
3lvRegAnimals.Columns.Add("Id", -2, HorizontalAlignment.Left);
4lvRegAnimals.Columns.Add("Name", -2, HorizontalAlignment.Left);
5lvRegAnimals.Columns.Add("Age", -2, HorizontalAlignment.Left);
1ListView friendsListView = findViewById(R.id.friendListView);
2final ArrayList<String> myFriends = new ArrayList<String>(asList("Mark","Jane","Sussy","Jan"));
3ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, myFriends);
4friendsListView.setAdapter(arrayAdapter); // Set an adapter
5friendsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
6 @Override
7 public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
8 Toast.makeText(getApplicationContext(), "Hello " + myFriends.get(i), Toast.LENGTH_LONG).show();
1class YourView(ListView):
2 model = YourModel
3 paginate_by = your_pagination_number
4 context_object_name = 'your_model_in_plural'
5 template_name = 'your_list.html'