<Kotlin/Android: Finding all Views of type T recur...
# stackoverflow
u
Kotlin/Android: Finding all Views of type T recursively So I have this extension function for ViewGroup : inline fun ViewGroup.allViewsOfType(action: (T) -> Unit) { val views = Stack() afterMeasured { views.addAll((0 until childCount).map(this::getChildAt)) } while (!views.isEmpty()) { views.pop().let { if (it is T) action(it) if (it is ViewGroup) { afterMeasured { views.addAll((0 until childCount).map(this::getChildAt)) }...