這是我的xml佈局,我試圖將Adview放置在回收站視圖的下方,以便廣告不會與回收站視圖中的任何項目重疊,但截至目前Adview不是顯示。我應該如何放置這些項目,使工具欄位於頂部和底部,使用刷卡刷新監聽器進行回收器視圖,並在其下方顯示AdView和所有這些應該在屏幕上可見。XML佈局無法正常顯示視圖
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_recipe_results2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:titleTextColor="@color/textIcons" />
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/pull_to_refresh"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:dividerHeight="0dp"
android:fadingEdge="none" />
</android.support.v4.widget.SwipeRefreshLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER" />
裘德嗨,您可以嘗試相對佈局,而不是使用線性佈局。在您的代碼中,當您在回收視圖中填充信息時,它們沒有高度限制,使用相對佈局可以設置屬性的固定位置。 –