Populating row Views
Now that we have an instance of the view, we need to populate the fields. The View
class defines a named FindViewById<T>
method, which returns a typed instance of a widget contained in the view. You pass in the resource ID defined in the layout file to specify the control you wish to access.
The following code returns access to nameTextView
and sets the Text property:
PointOfInterest poi = this [position]; view.FindViewById<TextView>(Resource.Id.nameTextView).Text = poi.Name;
Populating addrTextView
is slightly more complicated because we only want to use the portions of the address we have, and we want to hide the TextView
if none of the address components are present.
The View.Visibility
property allows you to control the visibility ...
Get Xamarin Mobile Application Development for Android - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.