Why does ProgressBar hide behind the button?

1

I created a RelativeLayout with a button and a circular ProgressBar. Here's how:

<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal">

  <Button
    android:id="@+id/btnLogin"
    android:theme="@style/ButtonStart"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/login" />

  <ProgressBar
    style="?android:attr/progressBarStyleSmall"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_marginLeft="14dp"
    android:layout_marginStart="14dp"
    android:id="@+id/progressBar4"/>

</RelativeLayout>

Regardless of the order, first entering Button and then ProgressBar , vice versa, after the compiled project, ProgressBar is always behind the button. Why does ProgressBar hide behind the button? What is the best way to solve this problem?

    
asked by anonymous 28.07.2017 / 19:19

1 answer

0

The problem is that you are not saying that Progress should stay.

Just add android:layout_below="@id/btnLogin" and the magic will be done.

Another option would be to use a LinearLayout with a vertical orientation.

    
28.07.2017 / 20:05