gpt4 book ai didi

java - Admob 与布局内容重叠

转载 作者:太空宇宙 更新时间:2023-11-04 12:12:22 25 4
gpt4 key购买 nike

我创建了一个应用程序并将 Admob 放入其中。但 admob 与我的相对布局中的内容重叠(我认为是这样)。

我的XML代码如下

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:id="@+id/main_frag"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"

xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:ads="http://schemas.android.com/apk/res-auto">

<!--
As the main content view, the view below consumes the entire
space available using match_parent in both dimensions.
-->
<com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayout
android:id="@+id/activity_main_swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srl_direction="both">

<android.support.v7.widget.RecyclerView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"

android:divider="@null"
android:scrollbars="none"/>

</com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayout>

<com.exfileexplorer.filemanager.ui.views.FastScroller
android:id="@+id/fastscroll"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_gravity="right"
android:layout_height="match_parent"/>
<RelativeLayout
android:id="@+id/nofilelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"

android:visibility="gone">

<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_insert_drive_file_white_36dp"/>

<TextView
style="@android:style/TextAppearance.Medium"
android:layout_width="wrap_content"
android:textColor="#666666"
android:id="@+id/nofiletext"
android:layout_marginTop="10dp"
android:layout_height="wrap_content"
android:layout_below="@id/image"
android:fontFamily="sans-serif-medium"
android:layout_centerHorizontal="true"
android:text="@string/nofiles"/>

</RelativeLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_home_footer" />
</FrameLayout>

屏幕截图 enter image description here我附上了它的样子的屏幕截图。根据 admob 政策,这显然是不道德的。如何在不违反广告政策的情况下将广告代码放置在它们之间。

最佳答案

将 admob block 放入相对布局中,并将 android:layout_below="@id/nofiletext"添加到 admob block 中,如下所示:

<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_home_footer"
android:layout_below="@id/nofiletext"/>
</RelativeLayout>

关于java - Admob 与布局内容重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39754823/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com