📌  相关文章
📜  android studio 查找布局中的所有视图 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:36.313000             🧑  作者: Mango

代码示例1
LinearLayout rootLinearLayout = (LinearLayout) findViewById(R.id.rootLinearLayout);
int count = rootLinearLayout.getChildCount();
for (int i = 0; i < count; i++) {
    View v = rootLinearLayout.getChildAt(i);
    if (v instanceof LinearLayout) {
        ...
    }
}