Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

horizontal ProgressBar is not full parent width

I am adding progress bar to my application AppBarLayout:

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="?attr/appBarLayoutTheme">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="?attr/toolbarPopupTheme"/>

    <ProgressBar
        style="?android:progressBarStyleHorizontal"
        android:id="@+id/progress_loader"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="-8dp"
        android:indeterminateTint="@color/greyishWhite"
        android:layout_marginTop="-9dp"
        android:maxWidth="2000dp"
        android:indeterminateOnly="true"/>

</android.support.design.widget.AppBarLayout>

Everything looks ok in portrait mode:

enter image description here

But on landscape mode it doesn't take full parent width:

enter image description here

How can I force ProgressBar take full with at all times.

ANSWER:

Thanks @Mahavir Jain for guiding to the right path:

at the end all needed to do was change

android:indeterminateOnly="true"

to

android:indeterminate="true"
like image 546
antanas_sepikas Avatar asked Jul 03 '18 06:07

antanas_sepikas


1 Answers

Remove below line.

android:indeterminateOnly="true"

android:indeterminateOnly Restricts to ONLY indeterminate mode (state-keeping progress mode will not work).

<ProgressBar
            android:id="@+id/progress_loader"
            style="?android:progressBarStyleHorizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="-8dp"
            android:layout_marginTop="-9dp"
            android:indeterminateTint="@color/red"
            android:max="100"
            android:progress="100"
            tools:ignore="UnusedAttribute" />
like image 159
Mahavir Jain Avatar answered Sep 19 '22 15:09

Mahavir Jain