android内部搜索控件下的子控件。比如:在某个VIEW对象里(LinearLayout)中 循环所有控件

/**
     * 遍历所有view
     * 
     * @param viewGroup
     */
    public void traversalView(ViewGroup viewGroup) {
        int count = viewGroup.getChildCount();
        for (int i = 0; i < count; i++) {
            View view = viewGroup.getChildAt(i);
            if (view instanceof ViewGroup) {
                traversalView((ViewGroup) view);
            } else {
                doView(view);
            }
        }
    }
 
    /**
     * 处理view
     * 
     * @param view
     */
    private void doView(View view) {
    }



原文地址:http://www.oschina.net/question/188389_147676

你可能感兴趣的:(java)