Xamarin Android - AbsListView

| Page Views: 25

This is an abstract class meant to be used to implement virtualized lists(and grids,carousels,stacks etc) of items.

AbsListView has been around since the official beginning of android.

Characteristics of AbsListView

AbsListView resides in the Android.Widget namespace:

namespace Android.Widget

AbsListView is an abstract class:

public abstract class AbsListView ..{}

AbsListView derives from AdapterView.

public abstract class AbsListView : AdapterView<IListAdapter>..{}

AbsListView implements several interfaces:

        public abstract class AbsListView : AdapterView<IListAdapter>, ITextWatcher, ViewTreeObserver.IOnGlobalLayoutListener, ViewTreeObserver.IOnTouchModeChangeListener, Filter.IFilterListener, INoCopySpan, IJavaObject, IDisposable{}

Use of AbsListView

The main aim of AbsListView, as we'd said is to implement virtualized lists of items.

Functionalities provided by AbsListView

Here are the some of the specific functionalities that AbsListView does offer to it's children: No. Use
1. Provides its children with the capability to generate their internal state into a parcelable form that can be later used to create a new instance of the same state. This is done by the use of OnSaveInstanceState() which returns a Parcelable. It also allows those children to later re-apply those generated internal states. This they do by passing IParcelable state into OnRestoreInstanceState(). These two methods, the AbsListView itself inherits from Android.View.View.
2. Provides XML attributes to its children that they can use to manipulate their visual representations. Majority of these attributes are inherrited from Android.View.View and Android.View.ViewGroup.
3. Defines several constants for specifying the different types of Lists based on the choice mode. These include: CHOICE_MODE_NONE,CHOICE_MODE_SINGLE,CHOICE_MODE_MULTIPLE and CHOICE_MODE_MULTIPLE_MODAL.
4. Defines several interfaces for listening to various events.These include IMultiChoiceModeListener which is used to receive events for CHOICE_MODE_MULTIPLE_MODAL,IOnScrollListener to listen to scroll events for Lists,grids etc.
5. Provides it's children with the AdapterView capability given that it itself derives from Android.Widget.AdapterView thus inheritting several methods.This is what allows it's children to be able to use Adapters to bind data.
6. Gives it's children views capability.These include the ability to set activation state, set background,set focusability etc.AbsListView is an indirect child of Android.View.View.
7. Provides it's subclasses with some viewgroup capabilities. These include among others the ability to add views to themselves,generate default layout parameters, get child views etc.
8. Allows us it's children to have TextWatcher capabilities.TextWatcher is an interface that allows it's implementers attached to Editables to be notified when text changes.

AbsListView Children

Several classes derive from this class:

View SubClass Type Description
GridView Direct Renders Items in a 2D scrolling grid.
ListView Direct Renders items in a scrollable vertical list.
ExpandableListeView Indirect Renders items in a scrollable vertical two level list.

Normally to render items, you won't use AbsListView, instead you'll use its children like ListView and GridView.

AbsListView is just the base class that provides the necessary abstraction to hold any type of list, be it grid, carousel or stack for these views.

AbsListView's subclasses like ListView and GridView rely on adapter for data binding. This is because AbsListView itself is an AdapterView.

How do You Feel after reading this?

According to scientists, we humans have 8 primary innate emotions: joy, acceptance, fear, surprise, sadness, disgust, anger, and anticipation. Feel free to tell us how you feel about this article using these emotes or via the comment section. This feedback helps us gauge our progress.

Help me Grow.

I set myself some growth ambitions I desire to achieve by this year's end regarding this website and my youtube channel. Am halfway. Help me reach them by:


What do You Think

Previous Post Next Post