findViewById(): only search among child views

also set default content view in Window
This commit is contained in:
Julian Winkler
2024-02-11 12:33:58 +01:00
parent d2f28a5b21
commit d253bfd24f
4 changed files with 24 additions and 8 deletions

View File

@@ -304,6 +304,17 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
public void setClipToPadding(boolean clipToPadding) {}
public View findViewById(int id) {
if (this.id == id)
return this;
for (View child: children) {
View result = child.findViewById(id);
if (result != null)
return result;
}
return null;
}
public static class LayoutParams {
public static final int FILL_PARENT = -1;
public static final int MATCH_PARENT = -1;