问题描述
总结一下我的问题:
我有一个在 SwiperRefreshLayout 中使用的 RecylerView。
除了这两个,我想在屏幕底部添加一个横幅广告。
当我在 SwipeRefreshLayout 上方添加标签 com.google.android.gms.ads.AdView
时,它看起来像这样:
但是当我在 SwipeRefreshLayout 下面添加 adview 的标签时,它消失了。屏幕上只显示 Recylerview。
没有广告:
如何将广告固定在屏幕底部?
我的代码是这样的:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="wrap_content"
android:background="@drawable/blur"
android:orientation="vertical"
tools:context=".MainActivity">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_above="@+id/adView"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycleView"
android:layout_above="@+id/adView"
android:layout_margin="2dp"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111"
android:layout_above="@+id/swipeRefreshLayout" />
</LinearLayout>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)