1
아래 코드를 사용하여 부모의 오른쪽 끝에 텍스트보기를 추가하려고합니다. 하지만 작동하지 않습니다.제약 조건 레이아웃에서 layout_constraintEnd_toEndOf를 프로그래밍 방식으로 달성하는 방법은 무엇입니까?
ConstraintSet constraintSet = new ConstraintSet();
TextView mValue1 = new TextView(getContext());
mValue1.setText("Value 1");
mValue1.setId(R.id.rightLabel1);
addView(mValue1);
constraintSet.clone(this);
constraintSet.connect(mValue1.getId(), ConstraintSet.TOP, this.getId(), ConstraintSet.TOP);
constraintSet.connect(mValue1.getId(), ConstraintSet.END, this.getId(), ConstraintSet.END);
constraintSet.applyTo(this);