a shows the completeness of an action. Can be used to show progress of some background action. Displays a bar to the user representing how far the operation has progressed; the application can change the amount of progress (modifying the length of the bar) as it moves forward. There is also a secondary progress displayable on a progress bar which is useful for displaying intermediate progress, such as the buffer level during a streaming playback progress bar.
Example show the completion of a downloading media file while that file plays, copying files etc.
Style:
Default style is medium size circular progress indicator Other two styles are progressBarStyleLarge & progressBarStyleSmall. Setting indicator progress programmatically.
Example:
mProgress = (ProgressBar)
findViewById(R.id.progress_bar);
mProgress.setProgress(75);
1)Progress bar on title
2)progressBarStyleHorizontal
3)progressBarStyleSmall
4)progressBarStyleLarge
Benefit of having ProgressBar on TitleBar. This can also make it easy to turn on and off an indeterminate progress indicator without changing the look of the screen.
Used to display progress on pages where items need to be loaded before the page can finish drawing.
To use the indeterminate indicator on your Activity objects title bar, Request the feature Window.
FEATURE_INDETERMINATE_PROGRESS.
A progress bar can also be made indeterminate. In indeterminate mode, the progress bar shows a cyclic animation without an indication of progress. This mode is used by applications when the length of the task is unknown. The indeterminate progress bar can be either a spinning wheel or a horizontal bar.
Example show the completion of a downloading media file while that file plays, copying files etc.
| Code: |
| <ProgressBar android:id=”@+id/progress_bar” android:layout_width=”wrap_content” android:layout_height=”wrap_content” /> <ProgressBar android:id=”@+id/progress_bar” style=”?android:attr/progressBarStyleHorizontal” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:max=”100” /> |
Default style is medium size circular progress indicator Other two styles are progressBarStyleLarge & progressBarStyleSmall. Setting indicator progress programmatically.
Example:
mProgress = (ProgressBar)
findViewById(R.id.progress_bar);
mProgress.setProgress(75);
1)Progress bar on title
2)progressBarStyleHorizontal
3)progressBarStyleSmall
4)progressBarStyleLarge
Benefit of having ProgressBar on TitleBar. This can also make it easy to turn on and off an indeterminate progress indicator without changing the look of the screen.
Used to display progress on pages where items need to be loaded before the page can finish drawing.
To use the indeterminate indicator on your Activity objects title bar, Request the feature Window.
FEATURE_INDETERMINATE_PROGRESS.
| Code: |
| requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); (Shows circular progress bar) requestWindowFeature(Window.FEATURE_PROGRESS); (Shows Horizontal progress bar) setContentView(R.layout.indicators); setProgressBarIndeterminateVisibility(true); setProgressBarVisibility(true); setProgress(5000); |




0 comments:
Post a Comment