我正在尝试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();