Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 apis,我不确定应用程序中将出现的复选框的数量。如何获得应用程序中产生的复选框数量的计数?此外,这些复选框是在 listView 中声明的。
您可以遍历布局中的所有子视图,并找出其中有多少是复选框。循环和检查通过以下方式完成:
ll is LinearLayout here int childcount = ll.getChildCount(); for (int i=0; i < childcount; i++){ View v = ll.getChildAt(i); if (view instanceof CheckBox) { count++; } }