0

I'm trying to change my divider vertical bias programatically and i tried this how to MODIFY a constraint layout programmatically? , but none of the solutions worked for me. When i tried it on my divider whole app was reseting, and want to stay in 2 activity. What should i do ? There are several other dividers connected to the one i'm trying to move, if this changes anything.

Divider xml :

    <View
    android:id="@+id/divider2"
    android:layout_width="15dp"
    android:layout_height="15dp"
    android:background="#48B130"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/divider" />

2nd Divider attached to 1st one :

    <View
    android:id="@+id/divider3"
    android:layout_width="15dp"
    android:layout_height="15dp"
    android:layout_marginTop="2dp"
    android:background="#48B130"
    app:layout_constraintEnd_toEndOf="@+id/divider2"
    app:layout_constraintStart_toStartOf="@+id/divider2"
    app:layout_constraintTop_toBottomOf="@+id/divider2" />

2nd activity code(empty) :

 public class GRA extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_gr);
}

1 Answers1

1

Probably, you should create a new LayoutParams with your settings and apply to that view.

Said
  • 689
  • 6
  • 20