skip to Main Content

I want to place the ad at the end of this WebView..

But when I place it under the WebView, it does not show. If I place it above the WebView, I will show as like as the attachment….

enter image description here

I try to change width and height, but it also does not work! That is why from my Facebook audience shows me a warning that your ad placement is wrong..
How can I fix it?

<androidx.constraintlayout.widget.ConstraintLayout 
    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=".Policy.PrivacyPolicy">


    <LinearLayout


        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="#E53935"
            android:textAlignment="center"
            app:popupTheme="@style/Theme.BangabandhuT20Cup.PopupOverlay"
            app:title="@string/privacy_policy_title"
            app:titleTextColor="#FFFFFF">
        </androidx.appcompat.widget.Toolbar>

       


        <WebView
            android:id="@+id/policyWebView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
        </WebView>
        <!--Google Admob Code-->
        <com.google.android.gms.ads.AdView
            android:id="@+id/banner_container00"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            app:adSize="BANNER"
            app:adUnitId="@string/ad_id">

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


    </LinearLayout>


</androidx.constraintlayout.widget.ConstraintLayout >

2

Answers


  1. <androidx.constraintlayout.widget.ConstraintLayout 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">
    
    
        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="#E53935"
            android:textAlignment="center"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:popupTheme="@style/Theme.BangabandhuT20Cup.PopupOverlay"
            app:title="@string/privacy_policy_title"
            app:titleTextColor="#FFFFFF"></androidx.appcompat.widget.Toolbar>
    
    
        <WebView
            android:id="@+id/policyWebView"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintBottom_toTopOf="@id/banner_container00"
            app:layout_constraintTop_toBottomOf="@id/toolbar" />
        <!--Google Admob Code-->
        
        <com.google.android.gms.ads.AdView
            android:id="@+id/banner_container00"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:adSize="BANNER"
            app:adUnitId="@string/ad_id"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"/>
        
    </androidx.constraintlayout.widget.ConstraintLayout>
    
    Login or Signup to reply.
  2. You can use constraintlayout.

    try this:

    <androidx.constraintlayout.widget.ConstraintLayout 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=".Policy.PrivacyPolicy">
    
    
    
        <androidx.appcompat.widget.Toolbar
            app:layout_constraintTop_toTopOf="parent"
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="#E53935"
            android:textAlignment="center"
            app:popupTheme="@style/Theme.BangabandhuT20Cup.PopupOverlay"
            app:title="@string/privacy_policy_title"
            app:titleTextColor="#FFFFFF"></androidx.appcompat.widget.Toolbar>
    
    
    
    <WebView
        android:id="@+id/policyWebView"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintTop_toBottomOf="@id/toolbar"
        app:layout_constraintBottom_toTopOf="@id/banner_container00"/>
    
    <!--Google Admob Code-->
    <com.google.android.gms.ads.AdView
        android:id="@+id/banner_container00"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        app:adSize="BANNER"
        app:adUnitId="ca-app-pub-2820216276511886/6822924493"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent">
    
    </com.google.android.gms.ads.AdView> </androidx.constraintlayout.widget.ConstraintLayout>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search