【发布时间】:2015-12-11 10:38:07
【问题描述】:
我正在尝试将我的 Admob 横幅冻结在我的页面底部,类似于这张图片 -
但是,我的活动包含标签和多个页面。每当我尝试将 adView 放在底部时,都会出现一些参数错误。如何插入 adView 并将其与布局底部对齐?我也尝试过 RelativeLayout 对应项,但无济于事。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:windowActionBar="false"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent">
<com.tk.cocguide.tabs.SlidingTabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="2dp"
android:background="@color/cyan_900"/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_weight="1">
</android.support.v4.view.ViewPager>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</LinearLayout>
【问题讨论】: