Enumerate/Iterate all Views in Activity?

后端 未结 8 544
忘了有多久
忘了有多久 2020-12-09 17:33

Is there a way to iterate through all the views in your Activity? Something like:

Iterator it = getViewIterator();
...

Does this exi

8条回答
  •  醉梦人生
    2020-12-09 18:03

    Activity Generally contains one main Layout Container in which all other views are placed. Using the reference of Main Layout Container. Traverse through its child (Use getChild(postion) , getchildcount() etc). and if any child is a container itself then apply the same function on it..This is some like traversing a tree structure

提交回复
热议问题