枚举/迭代中活动的所有意见?意见、迭代

2023-09-13 01:51:03 作者:こ 不负如来不负卿

有没有一种方法来遍历在活动各方面的意见?是这样的:

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

Iterator it = getViewIterator();
...

这是否存在呢?我找不到它的任何气味的任何地方...

Does this exist at all? I couldn't find any scent of it anywhere...

谢谢! 猪

推荐答案

如果你有你的的LinearLayout 或其他容器中的所有浏览扩展的ViewGroup 则可以使用功能 getChildCount() getChildAt(INT)和遍历所有的的 包含了意见。

If you have all your Views in a LinearLayout or an other container that extends ViewGroup you can use the functions getChildCount() and getChildAt(int) and iterate through all of the contained views.

希望这有助于。