I am trying to replicate the experience found when you are uninstalling an app in ICS. Specifically the indeterminate progress indicator under the title bar. I have tried using requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS)
and the various methods on Activity
but to no avail. It instead shows a spinning progress bar in the top right hand corner of the screen/title bar. Am I missing something simple here? Or is this completely custom?
Here is the code I am using:
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState);
setProgressBarIndeterminate(true);
setProgressBarIndeterminateVisibility(true);
}
ProgressBar is used to display the progress of an activity while the user is waiting. You can display an indeterminate progress (spinning wheel) or result-based progress.
In android, the ProgressBar supports two types of modes to show the progress, those are Determinate and Indeterminate.
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.
Progress bars are used to show progress of a task. For example, when you are uploading or downloading something from the internet, it is better to show the progress of download/upload to the user. In android there is a class called ProgressDialog that allows you to create progress bar.
You are using the ActionBar
indeterminate progress bar, but you are looking for a ProgressBar
View.
You can create the View
programmatically or add it to a layout file like --
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:indeterminate="true" />
Typically, you can decide when it is shown by calling .setVisibility(View.VISIBLE)
to show and .setVisibility(View.GONE)
when you are done.
If you have a minimum API of 11 and set your activity or app theme to @android:style/Theme.Holo
you will get exactly that ProgressBar
shown in your image.
If you want a similar effect on pre-API 11 devices, check out HoloEverywhere
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With