public abstract class

AbsListView

extends View
java.lang.Object
   ↳ com.neomades.ui.View
     ↳ com.neomades.ui.AbsListView
Known Direct Subclasses

Class Overview

Base class that can be used to implement virtualized lists of items.

Summary

XML Attributes
Attribute Name Related Method Description
selectionColorEnabled setSelectionColorEnabled(boolean)  
separatorColor setSeparatorColor(Color) #AARRGGBB or a color  
separatorVisible setSeparatorVisible(boolean)  
[Expand]
Inherited XML Attributes
From class com.neomades.ui.View
[Expand]
Inherited Constants
From interface com.neomades.ui.Alignment
From interface com.neomades.ui.StretchMode
Public Methods
void addView(View view, int atIndex)
Inserts a view at a specified position.
void addView(View view)
Add a new item view to the list.
int getViewsCount()
Returns the number of views inside this container.
void notifyDataChanged()
Notifies the list that data has changed and the list should update the UI.
void removeAllViews()
Remove all views from this container.
void removeIndex(int index)
Remove a view at the specified index.
void removeView(View view)
Remove a view from this list.
void setFadingEdgeColor(Color color)
Sets the fading edge color.
void setFadingEdgeEnabled(boolean enabled)
Sets if the vertical/horizontal edges should be faded when this view is scrolled vertically/horizontally.
void setFadingEdgeLength(int length)
Sets the fading edge length
void setFastScrollEnabled(boolean enabled)
Specifies whether fast scrolling is enabled or disabled.
void setHorizontalScrollBarEnabled(boolean scrollBarEnabled)
Displays or hides the horizontal scroll bar.
void setIndexerEnabled(boolean indexerEnabled)
Enables or not the alphabetic indexer.
void setIndexes(String[] indexes)
Sets a specific list of indexes to show on the right of the list.
void setItemClickedListener(ItemClickedListener listener)
Set the item clicked listener.
void setItemTypeAdapter(ItemTypeAdapter itemTypeAdapter)
Sets the adapter that provides the data type to differentiate the data item views in this widget.
void setListAdapter(ListAdapter adapter)
Sets the adapter that provides the views to represent the data in this list.
void setListIndexer(ListIndexer indexer)
Sets the alphabetical indexer at the right of the list.
void setListScrollListener(ListScrollListener listener)
Associates a ListSrollListener with this ListView.
void setRowHeight(int height)
Sets the row height in DP unit for every row.
void setSectionsVisible(boolean visible)
Enables or not section items in the list.
void setSelectionColor(Color selectionColor)
Changes the default color that is applied when a user select an item.
void setSelectionColorEnabled(boolean selectionEnabled)
Enables or disables the fact that the colors of an item changes when an user selects it.
void setSeparatorColor(Color separatorColor)
Changes the color of the separators between each items of the list.
void setSeparatorHeight(int height)
Sets the size of the separator between two items of the list.
void setSeparatorVisible(boolean visible)
Displays or hide the separator (usually a line) between between each items in the list.
void setVerticalScrollBarEnabled(boolean scrollBarEnabled)
Displays or hides the vertical scroll bar.
[Expand]
Inherited Methods
From class com.neomades.ui.View
From class java.lang.Object

XML Attributes

selectionColorEnabled

separatorColor

#AARRGGBB or a color

Related Methods

separatorVisible

Public Methods

public void addView (View view, int atIndex)

Inserts a view at a specified position.

Parameters
view the view to insert
atIndex the position index
Throws
CrossThreadException if the method is called from outside the UI-Thread

public void addView (View view)

Add a new item view to the list.

Do not use this method and setListAdapter(ListAdapter) at the same time.

Parameters
view child to add
Throws
CrossThreadException if the method is called from outside the UI-Thread
IllegalStateException if the view child has already a parent

public int getViewsCount ()

Returns the number of views inside this container.

Returns
  • the number of views

public void notifyDataChanged ()

Notifies the list that data has changed and the list should update the UI.

The scroll position will not change but visible items will be refreshed.

public void removeAllViews ()

Remove all views from this container.

Throws
CrossThreadException if the method is called from outside the UI-Thread

public void removeIndex (int index)

Remove a view at the specified index.

Parameters
index the index of the view to remove
Throws
CrossThreadException if the method is called from outside the UI-Thread

public void removeView (View view)

Remove a view from this list. if the view is not a child of this ListView, an IllegalStateException is thrown.

Parameters
view the view to remove
Throws
CrossThreadException if the method is called from outside the UI-Thread
IllegalStateException if the view is not a child of this list
NullPointerException if the view is null

public void setFadingEdgeColor (Color color)

Sets the fading edge color.

Parameters
color color to use
Throws
NullPointerException if color is null

public void setFadingEdgeEnabled (boolean enabled)

Sets if the vertical/horizontal edges should be faded when this view is scrolled vertically/horizontally.

Parameters
enabled true if the vertical/horizontal edges should be faded when the view is scrolled vertically/horizontally

public void setFadingEdgeLength (int length)

Sets the fading edge length

Parameters
length length in DP units, if 0 or negative, the default length will be set

public void setFastScrollEnabled (boolean enabled)

Specifies whether fast scrolling is enabled or disabled.

When fast scrolling is enabled, the user can quickly scroll through lists by dragging the fast scroll thumb.

Limitations

This method has effects only on Android.

Parameters
enabled true to enable fast scrolling, false otherwise

public void setHorizontalScrollBarEnabled (boolean scrollBarEnabled)

Displays or hides the horizontal scroll bar. Visible by default.

Parameters
scrollBarEnabled false to hide the scroll bar

public void setIndexerEnabled (boolean indexerEnabled)

Enables or not the alphabetic indexer.

Parameters
indexerEnabled true to diplay the indexer

public void setIndexes (String[] indexes)

Sets a specific list of indexes to show on the right of the list.

By default, indexes are letters from the alphabet (#ABC....XYZ where # means 0-9).

Parameters
indexes the indexes to show

public void setItemClickedListener (ItemClickedListener listener)

Set the item clicked listener.

Parameters
listener the callback that listen what item has been clicked

public void setItemTypeAdapter (ItemTypeAdapter itemTypeAdapter)

Sets the adapter that provides the data type to differentiate the data item views in this widget.

Note: Using ListAdapters is mandatory to use this adapter.

Parameters
itemTypeAdapter The adapter to use to differentiate item view types.

public void setListAdapter (ListAdapter adapter)

Sets the adapter that provides the views to represent the data in this list.

The scroll position will be reset at the start of the list.

Do not use this method and addView(View) at the same time.

Parameters
adapter The adapter to use to create this view's content.

public void setListIndexer (ListIndexer indexer)

Sets the alphabetical indexer at the right of the list.

Parameters
indexer an alphabetic indexer or null

public void setListScrollListener (ListScrollListener listener)

Associates a ListSrollListener with this ListView. The ListSrollListener will allow to follow the first item visible and the number of visible items of the ListView while the user is scrolling.

Parameters
listener a ListSrollListener

public void setRowHeight (int height)

Sets the row height in DP unit for every row.

Use this method to apply the same height to all rows.

This method could not be used if a RowHeightAdapter is set. See setRowHeightAdapter(RowHeightAdapter)

Parameters
height the row height in DP
See Also
  • #setRowHeightAdapter(RowHeightAdapter)

public void setSectionsVisible (boolean visible)

Enables or not section items in the list.

Limitations

This method does nothing on Android.

Parameters
visible true to show sections

public void setSelectionColor (Color selectionColor)

Changes the default color that is applied when a user select an item.

Parameters
selectionColor the new color to apply

public void setSelectionColorEnabled (boolean selectionEnabled)

Enables or disables the fact that the colors of an item changes when an user selects it.

Related XML Attributes
Parameters
selectionEnabled true to enable the color change, false otherwise

public void setSeparatorColor (Color separatorColor)

Changes the color of the separators between each items of the list. If the separators were hidden (see setSeparatorVisible(boolean), they will become visible.

Related XML Attributes
Parameters
separatorColor the color of the separator
Throws
NullPointerException if the separatorColor argument is null

public void setSeparatorHeight (int height)

Sets the size of the separator between two items of the list.

Limitations

This method does nothing in iOS.
For the moment you can change its color with setSeparatorColor(Color) or hide it with setSeparatorVisible(boolean)

Parameters
height the size of the separators

public void setSeparatorVisible (boolean visible)

Displays or hide the separator (usually a line) between between each items in the list.

Cross Platform consideration

To follow the native platform behaviors:

  • For Android and iOS, the separator is visible by default.

Related XML Attributes
Parameters
visible true to display the separators, false otherwise

public void setVerticalScrollBarEnabled (boolean scrollBarEnabled)

Displays or hides the vertical scroll bar. Visible by default.

Parameters
scrollBarEnabled false to hide the scroll bar