android - 如何在相对布局中设置带有 web 视图的广告而不重叠?
问题描述
在此布局中,Google 广告与 web 视图重叠。这就是 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: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>
推荐阅读
- sql - 仅当其他 B 具有值(对于每个 A)时,如何从 PostgreSQL 查询中删除空 B?
- google-apps-script - 将 Google 插件连接到 google vm 实例
- html - 锚点/伪 URL 隐藏/显示 CSS 问题
- javascript - 如何使用javascript在分页中添加下一个和上一个按钮以及一些页码
- asp.net-mvc - 具有受信任域成员身份的 ASP.NET User.IsInRole()
- node.js - 如何在 .jsx 文件中呈现 mongoose 查询中的元素?
- apache-kafka - kafka acl授权中的adminclient-congs.conf应该是什么
- docker - 使用 docker-compose 进行 Cronjob
- reactjs - 将 ReactJS Web 应用程序 Web 部署到 IIS
- sql - 在 SQL Server 中确定每个用户每天 10 分钟间隔内的访问时间集群