The second type is a horizontal ProgressBar that shows the completeness of an

The second type is a horizontal progressbar that

This preview shows page 65 - 73 out of 99 pages.

The second type is a horizontal ProgressBar that shows the completeness of an action. For example, you can see how much of a file has downloaded. The horizontal ProgressBar can also have a secondary progress indicator on it. This can be used to show the completion of a downloading media file while that file plays.
Image of page 65

Subscribe to view the full document.

Indicating Progress with ProgressBar (Cont’d) <ProgressBar android:id="@+id/progress_bar" android:layout_width="wrap_content" android:layout_height="wrap_content" />
Image of page 66
Indicating Progress with ProgressBar (Cont’d) The default style is for a medium-size circular progress indicator. This is not a “bar” at all. The other two styles for indeterminate ProgressBar are progressBarStyleLarge and progressBarStyleSmall . These styles animate automatically.
Image of page 67

Subscribe to view the full document.

Indicating Progress with ProgressBar (Cont’d) <ProgressBar android:id="@+id/progress_bar" style="?android:attr/progressBarStyleHorizontal" android:layout_width=" match_parent" android:layout_height="wrap_content" android:max="100" /> This example shows the layout definition for a horizontal progress indicator. In this example, we have also set the attribute for max to 100. This can help mimic a percentage ProgressBar ; that is, setting the progress to 75 shows the indicator at 75% complete.
Image of page 68
Indicating Progress with ProgressBar (Cont’d) We can set the indicator progress status programmatically as follows: mProgress = (ProgressBar) findViewById(R.id.progress_bar); mProgress.setProgress(75);
Image of page 69

Subscribe to view the full document.

Adding Progress Indicators to the ActionBar You can also put a ProgressBar in your application’s title bar. This can save screen real estate and can also make it easy to turn an indeterminate progress indicator on and off without changing the look of the screen. Indeterminate progress indicators are commonly used to display progress on pages where items need to be loaded before the page can finish drawing. This is often employed on Web browser screens.
Image of page 70
Adding Progress Indicators to the ActionBar (Cont’d) <android.support.v7.widget.Toolbar xmlns:app="" android:id="@+id/toolbar_progress" android:background="@color/bg_color" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:theme="@style/ToolbarTheme"> <ProgressBar android:id="@+id/toolbar_spinner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end" android:indeterminate="true" android:visibility="gone" /> </android.support.v7.widget.Toolbar> This XML allows you to set two different progress bars on a Toolbar found in the appcompat- v7 Support Library which is set up as the ActionBar of your Activity .
Image of page 71

Subscribe to view the full document.

Adding Progress Indicators to the ActionBar (Cont’d) supportRequestWindowFeature(Window.
Image of page 72
Image of page 73
  • Summer '16

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes