ProgressBarCircularIndeterminate 不与 imageView 一起出现

ProgressBarCircularIndeterminate doesn't appear with an imageView

这是我的布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.gc.materialdesign.views.ProgressBarCircularIndeterminate
        android:id="@+id/progressBarCircularIndeterminate"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:background="@color/actionbar_green"
        android:elevation="10dp"
        android:layout_above="@+id/splash_screen_image"
        android:gravity="center_vertical|center_horizontal"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true" />

        <ImageView
            android:id="@+id/splash_screen_image"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

</RelativeLayout>

问题是 circleprogressbar 没有出现在 imageview 中,但是当我删除 imageview 时,circleprogressbar 出现了。

图像视图覆盖了进度条,请重新排序您的视图,如

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

        <ImageView
            android:id="@+id/splash_screen_image"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    <com.gc.materialdesign.views.ProgressBarCircularIndeterminate
        android:id="@+id/progressBarCircularIndeterminate"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:background="@color/actionbar_green"
        android:elevation="10dp"
        android:layout_above="@+id/splash_screen_image"
        android:gravity="center_vertical|center_horizontal"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true" />

</RelativeLayout>

在你Activity

ProgressBarCircularIndeterminate pbci=(ProgressBarCircularIndeterminate)findViewByID(R.id.progressBarCircularIndeterminate);
pbci.bringToFront();

因为你的 ProgressBarCircularIndeterminate 在 ImageView 下面。

您可以改变它们的位置以获得您想要的。 就像这样:

<RelativeLayout
   ...>
   <ImageView .../>
   <ProgressBarCircularIndeterminate .../>
</RelativeLayout>