I have a LinearLayout, which contains several child TextViews. How can I get child views of that LinerLayout using a loop?
LinearLayout
TextViews
Use getChildCount() and getChildAt(int index).
getChildCount()
getChildAt(int index)
Example:
LinearLayout ll = … final int childCount = ll.getChildCount(); for (int i = 0; i < childCount; i++) { View v = ll.getChildAt(i); // Do something with v. // … }
1.4m articles
1.4m replys
5 comments
57.0k users