I have solved the issue adding a progess bar to the layout and then using a custom behaviour for the progress bar.
Layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="es.mediaserver.newinterfacedlna.MainActivity">
<android.support.design.widget.AppBarLayout android:layout_width="match_parent"
android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main"
android:id="@+id/include" />
<android.support.design.widget.FloatingActionButton android:id="@+id/fab"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_margin="28dp"
android:layout_gravity="bottom|center"
app:srcCompat="@android:drawable/ic_media_play" />
<ProgressBar
android:id="@+id/progressBar2"
style="?android:attr/progressBarStyle"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="bottom|center"
android:indeterminate="true"
android:layout_margin="@dimen/fab_margin"
/>
</android.support.design.widget.CoordinatorLayout>
Custom Behaviour component
public static class SnackBarBehavior extends CoordinatorLayout.Behavior<View> {
private static final boolean SNACKBAR_BEHAVIOR_ENABLED;
public SnackBarBehavior() {
super();
}
public SnackBarBehavior(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
return SNACKBAR_BEHAVIOR_ENABLED && dependency instanceof Snackbar.SnackbarLayout;
}
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight());
child.setTranslationY(translationY);
return true;
}
@Override
public void onDependentViewRemoved(CoordinatorLayout parent, View child, View dependency) {
child.setTranslationY(0);
}
static {
SNACKBAR_BEHAVIOR_ENABLED = Build.VERSION.SDK_INT >= 11;
}
}
And finally in the onCreate (or in the layout with app:layout_behavior="xxx.xxx.SnackBarBehavior")
ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar2);
SnackBarBehavior snackBarBehavior = new SnackBarBehavior();
CoordinatorLayout.LayoutParams coordinatorParams = (CoordinatorLayout.LayoutParams) progressBar.getLayoutParams();
coordinatorParams.setBehavior(snackBarBehavior);
Note: I based my behaviour component in the one posted here
How to move a view above Snackbar just like FloatingButton