Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Progress bar working on Android API 23, but not 21 or 22

Tags:

java

android

Here is the xml portion:

<ProgressBar
  android:layout_width="50dp"
  android:layout_height="match_parent"
  android:padding="15dp"
  android:layout_marginEnd="5dp"
  android:layout_alignParentEnd="true"
  android:visibility="gone"
  android:indeterminateTint="@color/colorPrimary"
  android:id="@+id/progressBar"
  android:indeterminate="true" />

I am using this to show and hide the progress bar:

progressBar.setVisibility(View.GONE);
progressBar.setVisibility(View.VISIBLE);

This is working just as I want it to on newer phones, but on API 21 and 22 the progress bar is never made visible.

like image 710
twharmon Avatar asked Dec 24 '16 06:12

twharmon


People also ask

How many types progress bar in Android?

Progress bar supports two modes to represent progress: determinate, and indeterminate. For a visual overview of the difference between determinate and indeterminate progress modes, see Progress & activity. Display progress bars to a user in a non-interruptive way.

What is indeterminate progress bar android?

Indeterminate Progress Bar is a user interface that shows the progress of an operation on the screen until the task completes. There are two modes in which you can show the progress of an operation on the screen. In this Android Indeterminate Progress Bar example, we will discuss in detail.

What are the different types of progress bars?

There are 2 types of progress bars: determinate and indeterminate. The former is used when the amount of information that needs to be loaded is detectable. The latter is used when the system is unsure how much needs to be loaded or how long it will take.

What is secondary progress android?

The primary progress is the current playing time of the video, while the secondary progress is the downloaded part of the video.


1 Answers

Adding android:indeterminateTintMode="src_in" fixed it:

<ProgressBar
  android:layout_width="50dp"
  android:layout_height="match_parent"
  android:padding="15dp"
  android:layout_marginEnd="5dp"
  android:layout_alignParentEnd="true"
  android:visibility="gone"
  android:indeterminateTint="@color/colorPrimary"
  android:indeterminateTintMode="src_in"
  android:id="@+id/progressBar"
  android:indeterminate="true" />
like image 61
twharmon Avatar answered Sep 21 '22 12:09

twharmon