【问题标题】:How can set up the ad with web view without overlapping in Relative layout?如何在相对布局中设置带有 web 视图的广告而不重叠?
【发布时间】:2021-10-27 14:26:47
【问题描述】:

Google 广告在此布局中的网络视图上方重叠。这就是 Google Admob 警告我的原因。我希望广告显示在 web 视图的末尾。我该怎么做?

我尝试这样做,但做不到。有人可以帮助我吗?我需要修复它...... 我尝试这样做,但做不到。有人可以帮助我吗?我需要修复它.....

?xml version="1.0" encoding="utf-8"

<RelativeLayout

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=".TeamInfo.Team1">



<com.github.ybq.android.spinkit.SpinKitView

android:id="@+id/spin kit"

style="@style/SpinKitView.Large.Circle"

android:layout width="wrap content"

android:layout height="wrap content"

android:layout gravity="center"

app:SpinKit Color="#E53935"

android:layout centerInParent="true"/>





<ImageView

android:id="@+id/teamimage1"

android:layout width="match parent"

android:layout height="match parent"

android:background="@drawable/commoninfo"

android:visibility="gone"/>



<WebView

android:id="@+id/team1web"

android:layout width="match parent"

android:layout height="match parent"

android:visibility="gone">

</WebView>





!—Google Admob Link—>

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

android:id="@+id/banner container1"

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>









</RelativeLayout>





<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    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=".TeamInfo.Team1">

    <com.github.ybq.android.spinkit.SpinKitView
        android:id="@+id/spin_kit"
        style="@style/SpinKitView.Large.Circle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        app:SpinKit_Color="#E53935"
        android:layout_centerInParent="true"/>


    <ImageView
        android:id="@+id/teamimage1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/commoninfo"
        android:visibility="gone"/>

    <WebView
        android:id="@+id/team1web"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone">
    </WebView>


    <!--Google Admob Code-->
    <com.google.android.gms.ads.AdView
            android:id="@+id/banner_container1"
            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>




</RelativeLayout>

【问题讨论】:

    标签: android android-studio android-layout admob android-relativelayout


    【解决方案1】:

    在你的网页视图中添加这一行

            android:layout_above="@id/banner_container1"
    

    下面的最终代码

    <WebView
            android:id="@+id/team1web"
            android:layout_above="@id/banner_container1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:visibility="visible">
    </WebView>
    

    【讨论】:

      猜你喜欢
      • 2018-06-05
      • 2017-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-14
      相关资源
      最近更新 更多