Android的发展:如何得到的ViewGroup所有的EditText孩子?有的、孩子、Android、ViewGroup

由网友(以女皇的霸气丶俯视全世界)分享简介:基本上,我有持有水平LinearLayouts的无规量的LinearLayout,并且在每个水平LinearLayouts的还有一个TextView和一个EditText。我希望能够得到高手的LinearLayout的每个孩子的EditText的价值。 Basically, I have a LinearLayout...

基本上,我有持有水平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.

阅读全文

相关推荐

最新文章