CollectionInfoCompat

Class with information if a node is a collection.

A collection of items has rows and columns and may be marked as hierarchical.

For example, a list where the items are placed in a vertical layout is a collection with one column and as many rows as the list items. This collection has 3 rows and 1 column and should not be marked as hierarchical since items do not exist at different levels/ranks and there are no nested collections.

  • Item 1
  • Item 2
  • Item 3

A table is a collection with several rows and several columns. This collection has 2 rows and 3 columns and is not marked as hierarchical:

Item 1Item 2Item 3
Item 4Item 5Item 6

Nested collections could be marked as hierarchical. To add outer and inner collections to the same hierarchy, mark them both as hierarchical.

For example, if you have a collection with two lists - this collection has an outer list with 3 rows and 1 column and an inner list within "Item 2" with 2 rows and 1 - you can mark both the outer list and the inner list as hierarchical to make them part of the same hierarchy. If a collection does not have any ancestor or descendant hierarchical collections, it does not need to be marked as hierarchical.

  • Item 1
  • Item 2
    • Item 2A
    • Item 2B
  • Item 3

To be a valid list, a collection has 1 row and any number of columns or 1 column and any number of rows.

Types

Link copied to clipboard
class Builder
Class for building CollectionInfoCompat objects.

Properties

Link copied to clipboard
Selection mode where multiple items may be selected.
Link copied to clipboard
Selection mode where items are not selectable.
Link copied to clipboard
Selection mode where a single item may be selected.
Link copied to clipboard
val UNDEFINED: Int = -1
Constant to denote a missing collection count.

Functions

Link copied to clipboard
open fun getColumnCount(): Int
Gets the number of columns.
Link copied to clipboard
Gets the number of items in the collection considered important for accessibility.
Link copied to clipboard
open fun getItemCount(): Int
Gets the number of items in the collection.
Link copied to clipboard
open fun getRowCount(): Int
Gets the number of rows.
Link copied to clipboard
open fun getSelectionMode(): Int
Gets the collection's selection mode.
Link copied to clipboard
Gets if the collection is a hierarchically ordered.
Link copied to clipboard
open fun obtain(rowCount: Int, columnCount: Int, hierarchical: Boolean): AccessibilityNodeInfoCompat.CollectionInfoCompat
open fun obtain(rowCount: Int, columnCount: Int, hierarchical: Boolean, selectionMode: Int): AccessibilityNodeInfoCompat.CollectionInfoCompat
Returns a cached instance if such is available otherwise a new one.