我试图在 ConstraintLayout 中的同一位置添加一个 View 至另一个 View,但是新添加的 View 没有得到原先 View 的 LayoutParams。
新添加的 View 位于容器的顶部或左侧。
以下是我的代码:
TextView cloneView = new TextView(getContext());
cloneView.setLayoutParams(otherView.getLayoutParams());
mainContainer.addView(cloneView);