开发者

How to find all child controls in an Activity (Android)

How do I find all child controls in an Activity. I want to get an enumeration 开发者_StackOverflowof all EditTexts, Spinnners and Checkboxes at runtime.

Thanks


You can't get a direct enumeration. You'll have to do a recursive walk using ViewGroup#getChildCount coupled with ViewGroup#getChildAt. Then you'll have to test using instanceof and process each view however you want depending on its type.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜