0

I have a Button and a ProgressBar inside a FrameLayout. How come my ProgressBar is visible only when Button is disabled? I'm running my app on android 6.0.1.

This is my layout file:

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

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <Button
            android:id="@+id/btn_love"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Love" />

        <ProgressBar
            android:id="@+id/progress_bar"
            style="?android:attr/indeterminateProgressStyle"
            android:layout_width="22dp"
            android:layout_height="22dp"
            android:layout_gravity="right|center_vertical"
            android:layout_marginRight="16dp" />
    </FrameLayout>

</LinearLayout>

enter image description here

Egis
  • 5,081
  • 5
  • 39
  • 61
  • 3
    Because it is hiding behind button because button's width is match_parent which takes full width of layout. – Dhruvi Jul 05 '16 at 12:19

1 Answers1

3

You should increase the elevation of the ProgressBar. You will find the reason here.

Community
  • 1
  • 1
artkoenig
  • 7,117
  • 2
  • 40
  • 61