我想把广告放在这个WebView的末尾..
但是当我把它放在WebView下面时,它没有显示出来。如果我把它放在WebView上面,我会像附件一样显示...

我尝试更改宽度和高度,但它也不起作用!这就是为什么我的Facebook观众会给我一个警告,说你的广告投放是错误的。我怎么才能修复它呢?
<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 >发布于 2021-08-16 09:56:16
<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>发布于 2021-08-16 10:00:30
您可以使用constraintlayout。
试试这个:
<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>https://stackoverflow.com/questions/68800508
复制相似问题