In my new app I need to show a animation while doing some processing(e.g sending data to the server, reading data from a web service, etc).
Something like this:
This is what I used to do when I wanted to implement something similar:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >   
    <RelativeLayout
        android:id="@+id/sincronizarSpinnerLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" >
        <ProgressBar
            android:id="@+id/pbHeaderProgress"
            style="@android:style/Widget.ProgressBar.Inverse"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true" >
        </ProgressBar>
    </RelativeLayout>
    <RelativeLayout>
      <!--Main content here-->
    </RelativeLayout>  
</LinearLayout>
As you can see I have two nested relative layouts. The first layout is invisible (android:visibility="gone") by default and I only make it visible when I start a Service, AsyncTask or asynchronous technique. 
Although I have used this method in the past, now that my main layouts (the ones that should go inside the second relative layout) are more complicated, I'm not sure it'd be a good idea to make things even more complicated by adding another nesting level to my activity.
- Is there any way I can avoid having to add another layout to all of my activities that need to display a spinner animation? Perhaps there's some kind of pattern or good practice I'm not aware of. 
- Do I really need to worry about adding another nesting level to my activity, knowing that I already have two or three levels? 
Thanks.

 
     
     
     
     
    