Android的发展:如何得到的ViewGroup所有的EditText孩子? [英] Android Development: How To Get All EditText Children of a ViewGroup?

查看:127
本文介绍了Android的发展:如何得到的ViewGroup所有的EditText孩子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我有持有水平LinearLayouts的无规量的LinearLayout,并且在每个水平LinearLayouts的还有一个TextView和一个EditText。我希望能够得到高手的LinearLayout的每个孩子的EditText的价值。

Basically, I have a LinearLayout that holds a random amount of horizontal LinearLayouts, and in each of the horizontal LinearLayouts there's a TextView and an EditText. I want to be able to get the value of each EditText children of the master LinearLayout.

很抱歉,如果它的混乱,我也不擅长解释事物!

Sorry if it's confusing, I'm no good at explaining things!

我能不能设置相同的ID为每个EditTexts的再使用findViewById,或将只返回一个EditText的第一个实例?

Could I just set the same ID for each of the EditTexts then use findViewById, or would that only return the first instance of an EditText?

谢谢,
亚历克斯。

Thanks, Alex.

推荐答案

您需要调用findViewById在每个LinearLayouts的。如果你这样做,你可以设置相同的ID为每个的EditText。

You would need to call findViewById on each of the LinearLayouts. If you do this, you can set the same ID for each EditText.

这篇关于Android的发展:如何得到的ViewGroup所有的EditText孩子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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