1
다음은 내 xml 파일입니다. 이 admob은 페이지의 맨 아래에 있습니다. 그러나 나는 스크린의 중앙에 admob 광고를 보여줄 필요가있다. 문제를 해결하기 위해 무엇을 할 수 있습니까?어떻게 화면 중앙에 내 Admob 배너 광고를 게재 할 수 있습니까?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="test.MainActivity"
tools:showIn="@layout/app_bar_main">
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/include_playerstrip">
<android.support.v4.view.PagerTitleStrip
android:id="@+id/pager_title_strip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="@color/colorPrimary"
android:paddingBottom="4dp"
android:paddingTop="4dp"
android:textColor="#fff" />
</android.support.v4.view.ViewPager>
<include
android:id="@+id/include_playerstrip"
layout="@layout/play_util" />
<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"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:layout_gravity="center_horizontal"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
나는 화면의 중앙을 표시해야 광고의 한 스크린 샷을 첨부했습니다.
AdView 위젯에 android : layout_centerInParent = "true"를 배치 해 보셨습니까? –
@AdamGardner 예 시도했지만 작동하지 않습니다. –