java.lang.Object | |||
↳ | com.neomades.ui.View | ||
↳ | com.neomades.ui.AbsListView | ||
↳ | com.neomades.ui.GridView |
A GridView
is a grid of views, where only one view could clicked
at the same time.
Each view could be different.
First, this grid could load views with adapter
instead of
calling addView()
. Do not call addView()
and provide an adapter to be called by this grid when the element
becomes visible.
The Adapter has two methods : getCount()
and
getView()
that help grids and
lists to load items.
getCount()
is called when data is ready to be loaded.
This grid will know how many items should be displayed. After that,
getView(int, View, View)
will be called when a item
becomes visible.
When data has changed, be sure calling the notifyDataChanged()
method to let the grid or list refreshing views.
XML Attributes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Attribute Name | Related Method | Description | |||||||||
listIndicatorVisible | setListIndicatorVisible(boolean) |
[Expand]
Inherited XML Attributes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | STYLE_GROUPED | A ListView whose sections present distinct groups of rows. | |||||||||
int | STYLE_PLAIN | A plain ListView. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
GridView()
Creates a new grid view.
| |||||||||||
GridView(int style)
Sets the iOS UITableView style.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
scrollToTop()
Move the scroll position to the first item of the
GridView . | ||||||||||
void |
setColumnAlignment(int columnIndex, int alignment)
Sets the column alignment with
Alignment constants for the column
specified in the parameter. | ||||||||||
void |
setColumnWidth(int width)
Sets the column width in DP unit for every column.
| ||||||||||
void |
setHorizontalSpacing(int space)
Set the amount of horizontal (x) spacing to place between each item in the
grid.
| ||||||||||
void |
setListIndicatorVisible(boolean indicatorVisible)
Displays or hide the list indicator (generally something that represents an
arrow at the tight of the ListView cell).
| ||||||||||
void |
setNumColumns(int numColumns)
Sets the number of columns of this
GridView . | ||||||||||
void |
setRowHeight(int height)
Sets the row height in DP unit for every row.
| ||||||||||
void |
setRowHeightAdapter(RowHeightAdapter rowHeightAdapter)
Sets an adapter for row heights.
| ||||||||||
void |
setSectionsVisible(boolean visible)
Enables or not section items in the list.
| ||||||||||
void |
setVerticalSpacing(int space)
Set the amount of vertical (y) spacing to place between each item in the
grid.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
A ListView whose sections present distinct groups of rows. The section headers and footers do not float.
A plain ListView. Any section headers or footers are displayed as inline separators and float when the ListView is scrolled.
Creates a new grid view.
Sets the iOS UITableView style. (Only for iOS)
style | STYLE_PLAIN (default) or STYLE_GROUPED |
---|
Sets the column alignment with Alignment
constants for the column
specified in the parameter.
A column alignment could be set if the view given by the adapter is in
MATCH_CONTENT
mode or has a fixed width.
By default, the left alignment is set.
columnIndex | 0 for the first column, a positive value for other columns, should be less than the number of columns |
---|---|
alignment | LEFT , HCENTER ,
RIGHT |
Sets the column width in DP unit for every column.
Use this method to apply the same width to all columns.
width | the column width in DP |
---|
Set the amount of horizontal (x) spacing to place between each item in the grid.
space | The amount of horizontal space between items, in DP unit. |
---|
Displays or hide the list indicator (generally something that represents an arrow at the tight of the ListView cell).
indicatorVisible | true to display the indicator |
---|
Sets the number of columns of this GridView
.
numColumns | number of columns |
---|
CrossThreadException | if the method is called from outside the UI-Thread |
---|
Sets the row height in DP unit for every row.
Use this method if this is the same row height for each row.
This method could not be used if a RowHeightAdapter
is set. See
setRowHeightAdapter(RowHeightAdapter)
height | the row height in DP |
---|
Sets an adapter for row heights.
The adapter gives an height for each row (could be different).
rowHeightAdapter | an adapter or null |
---|
Enables or not section items in the list.
This method does nothing on Android
.
visible | true to show sections |
---|
Set the amount of vertical (y) spacing to place between each item in the grid.
space | The amount of vertical space between items, in DP unit. |
---|