Linked Questions

Popular Questions

Google Admob banner below Navigation toolbar

Asked by At

Below is my Activity_main.xml file

Activity_Main.xml Screenshot

enter image description here

In my Android App Main Activity Layout, Google Admob is placed at below Top App Bar, and i want to switch the Admob banner to below Navigation Banner.

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="false"
    tools:openDrawer="start">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <android.support.design.widget.CoordinatorLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/parent_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <android.support.design.widget.AppBarLayout
                android:id="@+id/appbar_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/colorPrimary"
                android:fitsSystemWindows="true"
                android:theme="@style/ThemeOverlay.AppCompat.Light">

                <LinearLayout
                    android:id="@+id/appbar_main_layout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    app:layout_scrollFlags="scroll|enterAlways">

                    <LinearLayout
                        android:id="@+id/container_toolbar"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        app:layout_collapseMode="parallax">

                        <include
                            android:id="@+id/toolbar"
                            layout="@layout/toolbar" />

                    </LinearLayout>

                    <LinearLayout
                        android:id="@+id/container_admob"
                        android:layout_width="match_parent"
                        android:layout_height="50dp"
                        android:layout_marginTop="5dp"
                        android:layout_marginBottom="7dp"
                        android:background="#00ffffff"
                        android:gravity="center"
                        android:orientation="vertical"
                        android:visibility="visible">

                        <com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
                            android:id="@+id/adView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentBottom="true"
                            android:layout_centerHorizontal="true"
                            ads:adSize="BANNER"
                            ads:adUnitId="@string/banner_ad_unit_id">

                        </com.google.android.gms.ads.AdView>

                    </LinearLayout>

                </LinearLayout>

            </android.support.design.widget.AppBarLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@color/grey_3"
                android:focusableInTouchMode="true"
                android:layout_weight="1"
                android:orientation="vertical"
                app:layout_behavior="@string/appbar_scrolling_view_behavior" >

                <FrameLayout
                    android:id="@+id/container_body"
                    android:layout_width="fill_parent"
                    android:layout_height="0dp"
                    android:paddingBottom="?android:attr/actionBarSize"
                    android:layout_weight="1"
                    android:visibility="visible" />

            </LinearLayout>

        </android.support.design.widget.CoordinatorLayout>

        <android.support.design.widget.BottomNavigationView
            android:id="@+id/nav_bottom_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:layout_alignParentBottom="true"
            android:background="@android:color/white"
            app:itemIconTint="@drawable/color_state_primary_2"
            app:itemTextColor="@drawable/color_state_primary_2"
            app:menu="@menu/menu_nav_bottom" />

    </RelativeLayout>

</android.support.v4.widget.DrawerLayout>

In my Android App Main Activity Layout, Google Admob is placed at below Top App Bar, and i want to switch the Admob banner to below Navigation Banner.Please help me to resolve this, Thanks in advance!!

Related Questions