我需要以编程方式创建指南,并将视图应用于这些指南。
我使用了下面的代码,但它崩溃了。
我使用了下面的代码,但它崩溃了。
Guideline guideline = new Guideline(this);
guideline.setId(guideline.generateViewId());
constraintLayout.addView(guideline);
//Connecting view with the guideline
ConstraintSet set = new ConstraintSet();
set.connect(textView.getId(), ConstraintSet.RIGHT, guideline.getId(), ConstraintSet.LEFT);
set.applyTo(constraintLayout);
但是我得到了以下错误信息。
java.lang.AssertionError: LEFT(左侧)
我也不明白如何将方向应用于我创建的指南线。