In my XML-File I have a ConstaintLayout
. There I have a ImageView
with this settings:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toEndOf="@+id/game_square"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/ic_game_quadrat"
android:visibility="invisible"
android:id="@+id/game_right"/>
How can I access in the java file on the app:layout_constraintHorizontal_bias="1" to change it to for example 0.
Moritz
You can try something like
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(context, R.id.activity_constraint);
float biasedValue = 0f;
constraintSet.setHorizontalBias(R.id.game_right, biasedValue);
constraintSet.applyTo((ConstraintLayout) findViewById(R.id.activity_constraint));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With