我创建了一个应用程序并将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>
答案 0 :(得分:0)
将admob块放在相对布局中,并将这个android:layout_below =“@ id / nofiletext”添加到admob块,如下所示:
<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>