Skip to content Skip to sidebar Skip to footer

Horizontal Progress Bar Is Not Visible If Placed Above Toolbar (For Android 5)

I tried to place horizontal progress bar on the top of toolbar by having the following XML. my_activity.xml

Solution 1:

On Android 5.0+ devices, elevation is taken into account when determining the z-order of components - those with a higher elevation are visibly above those with a lower elevation, even if the higher elevation item is declared earlier in the XML file (normally causing it to be behind).

You can add an elevation to your ProgressBar, matching the elevation of the Toolbar - that will ensure that the same z-ordering works as in previous versions of Android.


Solution 2:

Try to use this:

<RelativeLayout
        android:id="@+id/container_toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <include
            android:id="@+id/toolbar"
            layout="@layout/toolbar" />

       // try to set your progress bar here
       // on top of the toolbar

    </RelativeLayout>

Post a Comment for "Horizontal Progress Bar Is Not Visible If Placed Above Toolbar (For Android 5)"