2012-02-24 9 views

答えて

0

お試しください

public View[] getViewArrays(int resid) 
    { 
     ViewGroup layout = (ViewGroup) this.findViewById(resid); 

     View[] views = new View[layout.getChildCount()]; 

     for (int i = 0; i < layout.getChildCount(); i++) { 
      views[i] = layout.getChildAt(i); 
     } 

     return views; 
    } 

    public int[] getViewIds(int resid) 
    { 
     ViewGroup layout = (ViewGroup) this.findViewById(resid); 

     int[] ids = new int[layout.getChildCount()]; 

     for (int i = 0; i < layout.getChildCount(); i++) { 
      ids[i] = layout.getChildAt(i).getId(); 
     } 

     return ids; 
    } 
関連する問題