2011-10-18 10 views

Respuesta

30

RelativeLayout extiende ViewGroup que tiene los métodos getChildCount() y getChildAt(int index). Entonces, lo que podrías probar es:

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

Gracias, funciona. –

+0

Útil, gracias^_ ^ –

1

Solo cuenta el niño para la vista e itera sobre cada una de ellas. Algo como esto:

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

Espero que esto ayude.

Cuestiones relacionadas