It is necessary that SnackBar should raise the Ad block above it. enter image description here

<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/cordinatorSavedList" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <ListView android:id="@+id/lvLists" android:layout_width="match_parent" android:layout_height="match_parent" /> <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom|center_horizontal" ads:adSize="SMART_BANNER" ads:adUnitId="@string/banner_ad_unit_id" /> </android.support.design.widget.CoordinatorLayout> 

Call code:

 CoordinatorLayout cordinatorSavedList = (CoordinatorLayout) v.findViewById(R.id.cordinatorSavedList); Snackbar.make(cordinatorSavedList, "Удалить список?", Snackbar.LENGTH_SHORT).show; 

    1 answer 1

    for your AdView, add in the markup:

     android:layout_gravity="bottom" ads:layout_dodgeInsetEdges="bottom" 

    From the documentation:
    dodgeInsetEdges - A Gravity value describing how this child view is in the CoordinatorLayout.

    • Thank you so much! :) I tried to apply the options using special classes, and here literally one line of code did everything :) - Evgeny
    • Usually, a custom Behavior class is written to the CoordinatorLayout for the View, but there is such a simple position change in the default - DeKaNszn