I'm only starting my adventure with Android so please excuse if the question is silly, but I've been looking for an answer long and hard to no avail. The question is simple: can I programmatically alter the value of this parameter?
app:layout_constraintTop_toBottomOf="@+id/divider1"
What I'm trying to do is rather simple: I have a visible row of objects with a divider underneath, and a TextView below that I've constrained to that divider's bottom. I also have a second row of objects with another divider underneath that starts with visibility set to GONE but can be toggled visible with a floating action button. I need the TextView below the first row to move lower to make room for the second row when it appears. I can use setY, but considering that the two rows are the same, just with different values, it would be way easier to simply change the top constraint of the TextView from "divider1" to "divider2". Can it be done? Here's what the button does at the moment:
addButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (!isPair2Visible) {
driverLabel2.setVisibility(View.VISIBLE);
followerLabel2.setVisibility(View.VISIBLE);
driver2.setVisibility(View.VISIBLE);
follower2.setVisibility(View.VISIBLE);
ratioLabel2.setVisibility(View.VISIBLE);
ratio2.setVisibility(View.VISIBLE);
divider2.setVisibility(View.VISIBLE);
isPair2Visible = true;
}
}
});
And this is the TextView that I need to move:
<TextView
android:id="@+id/totalRatio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/ratio_default"
android:textColor="@color/colorAccentOrange"
android:textSize="24sp"
app:layout_constraintStart_toStartOf="@+id/ratio1"
app:layout_constraintTop_toBottomOf="@+id/divider1" />
And everything would be perfect if I could alter the last line to:
app:layout_constraintTop_toBottomOf="@+id/divider2" />