ViewGroup: make updateViewLayout actually update the layout

This commit is contained in:
Mis012
2024-04-03 01:51:26 +02:00
parent e94a78fd14
commit 04ee40d010

View File

@@ -56,21 +56,20 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
protected void addViewInternal(View child, int index, LayoutParams params) { protected void addViewInternal(View child, int index, LayoutParams params) {
if (child.parent == this) if (child.parent == this)
return; return;
if (!checkLayoutParams(params)) { if (!checkLayoutParams(params))
params = generateLayoutParams(params); params = generateLayoutParams(params);
}
child.parent = this; child.parent = this;
child.setLayoutParams(params); child.setLayoutParams(params);
if (index < 0) if (index < 0)
index = children.size(); index = children.size();
children.add(index, child); children.add(index, child);
native_addView(widget, child.widget, index, params); native_addView(widget, child.widget, index, params);
if (isAttachedToWindow()) { if (isAttachedToWindow())
child.onAttachedToWindow(); child.onAttachedToWindow();
} if (onHierarchyChangeListener != null)
if (onHierarchyChangeListener != null) {
onHierarchyChangeListener.onChildViewAdded(this, child); onHierarchyChangeListener.onChildViewAdded(this, child);
}
requestLayout(); requestLayout();
} }
@@ -148,7 +147,7 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
} }
public void updateViewLayout(View view, ViewGroup.LayoutParams params) { public void updateViewLayout(View view, ViewGroup.LayoutParams params) {
/* FIXME */ view.setLayoutParams(params);
view.requestLayout(); view.requestLayout();
} }