遍历找到layout中的某种控件

 
  
private void findEditText(ViewGroup group)
{
    if (group != null)
    {
        for (int i = 0, j = group.getChildCount(); i < j; i++)
        {
            View child = group.getChildAt(i);
            if (child instanceof EditText)
            {
                EditText child1 = (EditText) child;
                if (isNeed(child1.getText().toString()))//根据需求判断是否添加
                    continue;
                edList.add(child1);
            } else if (child instanceof ViewGroup)
            {
                findEditText((ViewGroup) child);
            }
        }
    }
}


你可能感兴趣的:(懒癌笔记)