Populating ListView

A popular alternative to a spinner is the ListView instance. The ListView instances are views that will show a list of items in full screen with a vertical scrolling. In other words, it is equivalent to a full screen spinner, which is always active.

Getting ready

In order to follow this recipe, create a new project in the very same solution and name it Populating ListView.

How to do it...

  1. Edit the Main.axml file under Resource/Layout file with the following:
    <?xml version="1.0" encoding="utf-8"?>
    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/textItem"
      android:textSize="44sp"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" />
  2. Create another .axml file under Resource

Get Xamarin Studio for Android Programming: A C# Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.