- January 31, 2016
Continuing from my drawer example code…I have a fragment (About) where I want to show a number of rows. There are a few ways of doing this but in my case I am going to use a ListView.
A ListView is an important UI component of Android applications, used everywhere from short lists of menu options to long lists of contacts or internet favorites.
In our example we have the following components that make up our Activity.
Because we are working with Fragments we build our code within the OnCreateView method.
I have been able to do this within OnActivityCreated as well.
In this example Resource.Layout.About is the name of my Fragment (public class AboutFragment : Fragment), Resource.Id.aboutListView is referencing the ListView that was placed in the About.axml (see below), and the Resource.Layout.TextViewItem (blue) represents each row.
This is another way of approaching inside the OnActivityCreated method
TextViewItem.axml
<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" />