public class FindView {
public double mId;
public FindView[] mChildren;
public FindView findViewById(double id) {
if (mId == id) {
return this;
}
if (mChildren != null) {
for (int i = 0; i < mChildren.length; i++) {
FindView childView = mChildren[i];
FindView v = childView.findViewById(id);
if (v != null) {
return v;
}
}
}
return null;
}
}
手写findViewById,其实就是个递归
最新推荐文章于 2023-11-14 16:43:35 发布