I want to implement progressBar like on the picture below.
Right now, I have AsyncTask whic is sperated from fragments classes, and I use that AsyncTask to load data, and right now I have implement progressBar dialog, but I want to get rid of that, because I want make a better UX.
I show that ProgressBar dialog in onPreExecute() method, and then dismiss it onPostExecute.
So, how I can implement background Progress bar like on the picture below
Dude,
If you really just want a progress bar like the picture you posted, you can simply set the progress bar indeterminate property to true :)
You can eighter do on code or directly on the xml.
In code:
yourProgressBar.setIndeterminate(true);
In your XML, just set the attribute indeterminate to true.
Here's is a simple layout as an example:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:indeterminate="true" />
</RelativeLayout>