ViewGroup读取所有textview

ViewGroup read all textview

如果我使用ViewGroup,有什么方法可以读取所有TextView?

 ViewGroup viewGroup=(ViewGroup)view.getParent();
  int childCount = viewGroup.getChildCount();
       for (int i = 0; i < childCount; i++) {

                    TextView txtLikeStatus=(TextView)viewGroup.findViewById(R.id.ext);
                    String plus2= txtLikeStatus.getText().toString();
                    Toast.makeText(view.getContext(), "test:"+  txtLikeStatus, Toast.LENGTH_SHORT).show();
                            }

是试试这个:

 ViewGroup vg = (ViewGroup) view.getParent();
 for (int i = 0; i < vg.getChildCount(); i++) {
     View child = vg.getChildAt(i);
     if (child.getClass() == TextView.class) {
     //Do your work here. 
     }
 }

希望对您有所帮助。