Я создал 2 recyclerView внутри ConstraintLayout , который ограничен по горизонтали с chainStyle layout_constraintHorizontal_chainStyle="spread_inside"
, однако я хочу перевернуть их симметрично, используя ConstraintSet Очистить и Подключить . Когда я пытаюсь соединить виджеты с ConstraintSet CHAIN_SPREAD_INSIDE
, появляется эта ошибка
java .lang.IllegalArgumentException: справа налево undefined в android .support .constraint.ConstraintSet.connect (ConstraintSet. java: 1260)
, вот рисунок, который более подробно объясняет эту проблему, спасибо за помощь.
XML
<android.support.constraint.ConstraintLayout
android:id="@+id/clScoreboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerViewVisitorTeam"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:orientation="horizontal"
android:scrollbars="horizontal"
android:visibility="visible"
android:background="@color/colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/recyclerViewLocalTeam"
app:layout_constraintTop_toBottomOf="@+id/buttonContainer" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerViewLocalTeam"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:orientation="horizontal"
android:scrollbars="horizontal"
android:visibility="visible"
android:background="@color/colorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/recyclerViewVisitorTeam"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/buttonContainer">
</android.support.v7.widget.RecyclerView>
<android.support.constraint.ConstraintLayout
JAVA
ConstraintSet set = new ConstraintSet();
ConstraintLayout clScoreboard =
rencontreView.findViewById(R.id.clScoreboard);
set.clone(clScoreboard);
//REVERSE PLAYERS TEAMS
set.clear(R.id.recyclerViewLocalTeam, ConstraintSet.START);
set.clear(R.id.recyclerViewLocalTeam, ConstraintSet.TOP);
set.clear(R.id.recyclerViewLocalTeam, ConstraintSet.END);
set.clear(R.id.recyclerViewLocalTeam, ConstraintSet.BOTTOM);
set.clear(R.id.recyclerViewVisitorTeam, ConstraintSet.START);
set.clear(R.id.recyclerViewVisitorTeam, ConstraintSet.TOP);
set.clear(R.id.recyclerViewVisitorTeam, ConstraintSet.END);
set.clear(R.id.recyclerViewVisitorTeam, ConstraintSet.BOTTOM);
set.connect(R.id.recyclerViewLocalTeam, ConstraintSet.END, R.id.clScoreboard, ConstraintSet.END);
set.connect(R.id.recyclerViewLocalTeam, ConstraintSet.TOP, R.id.buttonContainer, ConstraintSet.BOTTOM);
set.connect(R.id.recyclerViewLocalTeam, ConstraintSet.BOTTOM, R.id.clScoreboard, ConstraintSet.BOTTOM);
set.connect (R.id.recyclerViewLocalTeam, ConstraintSet.START, R.id.recyclerViewVisitorTeam, ConstraintSet.END);
set.connect(R.id.recyclerViewVisitorTeam, ConstraintSet.START, R.id.clScoreboard, ConstraintSet.START);
set.connect(R.id.recyclerViewVisitorTeam, ConstraintSet.TOP, R.id.buttonContainer, ConstraintSet.BOTTOM);
set.connect(R.id.recyclerViewVisitorTeam, ConstraintSet.BOTTOM, R.id.clScoreboard, ConstraintSet.BOTTOM);
set.connect (R. id.recyclerViewVisitorTeam, ConstraintSet.END, R.id.recyclerViewLocalTeam, ConstraintSet.CHAIN_SPREAD_INSIDE);
set.applyTo(clScoreboard);