set parent before calling setLayoutParams()

Allows the parent gravity to get handled correctly
This commit is contained in:
Julian Winkler
2023-11-10 23:28:17 +01:00
parent 36d7a1cc44
commit e11d9ec6b6

View File

@@ -75,8 +75,8 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
if (!checkLayoutParams(params)) {
params = generateLayoutParams(params);
}
child.setLayoutParams(params);
child.parent = this;
child.setLayoutParams(params);
if (index < 0)
index = children.size();
children.add(index, child);