Я пытаюсь добавить ProgressBar
поверх Button
(оба находятся внутри ConstraintLayout
).
<Button
android:id="@+id/sign_in_button"
android:layout_width="280dp"
android:layout_height="75dp"
android:layout_marginBottom="75dp"
android:layout_marginTop="50dp"
android:text="@string/sign_in"
android:textColor="@color/white"
android:textSize="22sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/passwordEditText"
app:layout_constraintVertical_bias="0.0"/>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@+id/sign_in_button"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="@+id/sign_in_button"
android:layout_marginBottom="8dp"
app:layout_constraintVertical_bias="0.5"
android:layout_marginLeft="8dp"
app:layout_constraintLeft_toLeftOf="@+id/sign_in_button"
android:layout_marginRight="8dp"
app:layout_constraintRight_toRightOf="@+id/sign_in_button"/>
Но даже после вызова bringToFront
на ProgressBar
в onCreate
он всегда остается за Button
.
ProgressBar progressBar = (ProgressBar)findViewById(R.id.progressBar);
progressBar.bringToFront();