Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a progress bar under the ActionBar in Material Design?

The Material Design specifications for Progress and activity specifically show in several areas a horizontal progress indicator of only a few pixels (dips) thick below whatever it is we are calling the ActionBar these days (probably Toolbar).

However, I don't see any way to actually implement that portion of Material Design. There seems to be a disconnect between design and reality. To make things more complicated, all of the classic methods (e.g. setProgressBarIndeterminateVisibility()) are deprecated or gone (i.e. no-ops). Also, putting a horizontal ProgressBar below the Toolbar results in a very tall ProgressBar and all of the alternate AppCompat ProgressBar styles I've been able to find are also too tall. Attempting to force the height to '2dip' results in shrinking the width of whatever makes up the content of the ProgressBar.

So what is the correct, built-in AppCompat compliant method to putting a Material Design compliant horizontal ProgressBar at the bottom of either Toolbar or AppBarLayout?

I prefer it to be at the bottom of AppBarLayout because I'm adding more stuff after the Toolbar but before the end of AppBarLayout in my app. At the moment, I'm relegated to the circular indeterminate ProgressBar in a Toolbar but it is big and a bit ugly.

like image 256
maddog Avatar asked May 26 '16 19:05

maddog


Video Answer


1 Answers

Try this answer. But I would also suggest that you extend your own class from ProgressBar and call it from activity.

like image 67
Zon Avatar answered Sep 20 '22 14:09

Zon