indices
Returns an IntRange of the valid indices for the children of this view group.
This can be used for looping:
for (i in viewGroup.indices.reversed) {
if (viewGroup[i] is SomeView) {
viewGroup.removeViewAt(i)
}
}
Content copied to clipboard
Or to determine if an index is valid:
if (2 in viewGroup.indices) {
// Do something…
}
Content copied to clipboard