根据布局id遍历其内的子控件

        LinearLayout l = (LinearLayout)getViewById(rv.getLayoutId());
        int childCount = l.getChildCount();
        //遍历下面所有的子控件,判断是否是layout
        for(int i = 0; i < childCount; i++){
            if(l.getChildAt(i) instanceof LinearLayout
                    || l.getChildAt(i) instanceof RelativeLayout
                    || l.getChildAt(i) instanceof TableLayout
                    || l.getChildAt(i) instanceof AbsoluteLayout){
                //操作代码           
                }
        }

你可能感兴趣的:(Android)