2011-10-18 11 views

risposta

30

RelativeLayout estende ViewGroup che ha le getChildCount() e getChildAt(int index) metodi. Quindi quello che potresti provare è:

for(int i = 0; i < relativeLayout.getChildCount(); i++) { 
    View child = relativeLayout.getChildAt(i); 
    // your processing... 
} 
+0

Grazie funziona. –

+0

Utile, grazie^_ ^ –

1

Solo il bambino conta per la vista e itera su ciascuno di essi. Qualcosa di simile a questo:

int childCount = myRelativeLayout.getChildCount(); 
for(int i = 0; i < childCount; i++) { 
    View v = myRelativeLayout.getChildAt(i); 
    // do whatever you want to with the view 
} 

Spero che questo aiuti.

Problemi correlati