枚举/迭代中活动的所有意见? [英] Enumerate/Iterate all Views in Activity?

查看:87
本文介绍了枚举/迭代中活动的所有意见?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

希望这有助于。

这篇关于枚举/迭代中活动的所有意见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆