Skip to content

Instantly share code, notes, and snippets.

@davidortinau
Created October 26, 2017 12:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidortinau/a832487daef2378fdb8870bb3efe61db to your computer and use it in GitHub Desktop.
Save davidortinau/a832487daef2378fdb8870bb3efe61db to your computer and use it in GitHub Desktop.
using Android.Views;
public int Count = 0;
public void Iterate(View view) {
if (view is ViewGroup)
IterateViewChildren(view);
System.Console.WriteLine($"Total Children {Count}");
}
private void IterateViewChildren(View view) {
if (view is ViewGroup) {
ViewGroup vGroup = (ViewGroup)view;
for (int i = 0; i < vGroup.ChildCount; i++) {
View vChild = vGroup.GetChildAt(i);
IterateViewChildren(vChild);
}
}
Count++;
}
Iterate(selectedView);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment