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


Question: 

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.




1 Answer: 

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

 

More Articles


c++ - Windows Toolbar - Controlling button size and padding

I'm trying to understand the behaviour of a Windows toolbar - in particular how the following values interact:the size of the bitmap image usedthe effective size of a toolbar buttonthe padding between the image and the button edgethe height of the toolbarText displayed by a button is not relevant in

xamarin.android - How to align UI controls on a Custom Toolbar in Android xml

I'm creating a layout in Xamarin.Android and I'm working on a custom Toolbar with an image button a TextView and another label. What I need to do is Make sure the imagebutton BackButton is left aligned all the way to the left of the parent Contain, the TextView is Center Aligned and the MenuButton

java - Android Adding Buttons to Toolbar Programmatically

I am trying to create a toolbar programmatically and Add Left and Right Bar Button to it without using XML.But the button is not getting aligned to right.So kindly help me.Toolbar TopTulBarVar = new Toolbar(this);TopTulBarVar.setId(View.generateViewId());TopTulBarVar.setBackgroundColor(Color.parseCo


mfc - How do I handle toolbar messages in a dialog box

I am writing a MFC MDI application, which I started with the wizard, with visual studio 2017. In this application I have dialog boxes with toolbars. But when the dialog boxes are shown, the toolbar buttons are not enabled, even though the dialog classes contain handlers for the button IDs.For instan

visual studio - C# Registerhotkey() won't read some keycodes

While trying to create an auto clicker application using a Visual Studio Windows Form that allows you to select the hotkey you want, I stumbled upon a problemWhen a user inputs keys such as ~ or / the hotkey won't work, However, if I put in 0xC0 (for tilde) or 0xDC (for slash) instead of (int)[tilde

c# - WindowsForm app with wpf windows is not working on other computers

I'm new to WPF and c# programming,i have built a winform app with a database and some wpf forms.wpf forms contain some background images and componentone tab controls.To add wpf forms:i added a wpf user control and modified its code as a window.in that case i m unable to put background images from u


configuration - PhpStorm configure to work remotely

Hi is there a way for PhpStorm to work directly on a remote server? No local files. Because as of the moment PhpStorm has local files wherein it just automatically uploads all files during save on remote.My problem is if someone changes something remotely I need to manually download it first before

wpf - Adding NAudio controls to toolbox

I am trying to use the controls from NAudio library such as WaveViewer, VolumeMeter, VolumeSlider, Fader, WaveformPainter etc. I am using Visual Studio 2012 and have net 4.5 installed. I have also downloaded and referenced NAudio 1.7 and its .dll to my project. When I right click on toolbox and clic

How to disable "Project Files Changes" alert in phpstorm?

How to disable this alert box in phpstorm.

How to show a Horizontal Android Indeterminate Progress Bar

How to show an indeterminate horizontal progress bar in android? The animation of the progress bar should start from 0 to 100 and then go back from 100 to 0 continuously. I am not looking for the wheel progress bar.