移动 ad 不会放在布局的上,例如 ad 放置在底部。 这是布局的图像,我在说的是,看看布局的图像 这是 XML代码 for IT 谢谢您的查看。<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:ads="http://schemas.android.com/apk/res-auto"
tools:context="com.dancing.dance.girl"
android:background="@mipmap/vsdv">
<com.google.android.gms.ads.AdView
android:id="@+id/abovebeauty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
ads:adSize="BANNER"
ads:adUnitId="@string/dancinggirl">
</com.google.android.gms.ads.AdView>
<!-- TODO: Update blank fragment layout -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="2"
android:id="@+id/beauty_fragment"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2" >
<ImageButton
android:layout_width="0dp"
android:layout_height="fill_parent"
android:id="@+id/1"
android:layout_weight="1"
android:src="@drawable/lob"
android:background="@null"
android:scaleType="fitXY"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="5dp" />
<ImageButton
android:layout_width="0dp"
android:layout_height="fill_parent"
android:id="@+id/2"
android:layout_weight="1"
android:src="@drawable/lob"
android:background="@null"
android:scaleType="fitXY"
android:layout_marginTop="20dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2" >
<ImageButton
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="@drawable/lob"
android:background="@null"
android:scaleType="fitXY"
android:id="@+id/3"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="20dp"
android:layout_marginTop="5dp" />
<ImageButton
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="@drawable/lob"
android:background="@null"
android:scaleType="fitXY"
android:id="@+id/4"
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="5dp"
android:layout_marginBottom="20dp" />
</LinearLayout>
</LinearLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/beautyfragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/dancinggirl">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
plinearlayout下方放置广告布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:ads="http://schemas.android.com/apk/res-auto"
tools:context="com.dancing.dance.girl"
android:background="@mipmap/vsdv">
<!-- TODO: Update blank fragment layout -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="2"
android:id="@+id/beauty_fragment"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2" >
<ImageButton
android:layout_width="0dp"
android:layout_height="fill_parent"
android:id="@+id/1"
android:layout_weight="1"
android:src="@drawable/lob"
android:background="@null"
android:scaleType="fitXY"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="5dp" />
<ImageButton
android:layout_width="0dp"
android:layout_height="fill_parent"
android:id="@+id/2"
android:layout_weight="1"
android:src="@drawable/lob"
android:background="@null"
android:scaleType="fitXY"
android:layout_marginTop="20dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2" >
<ImageButton
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="@drawable/lob"
android:background="@null"
android:scaleType="fitXY"
android:id="@+id/3"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="20dp"
android:layout_marginTop="5dp" />
<ImageButton
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="@drawable/lob"
android:background="@null"
android:scaleType="fitXY"
android:id="@+id/4"
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="5dp"
android:layout_marginBottom="20dp" />
</LinearLayout>
</LinearLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/beautyfragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/dancinggirl">
</com.google.android.gms.ads.AdView>
<com.google.android.gms.ads.AdView
android:id="@+id/abovebeauty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
ads:adSize="BANNER"
ads:adUnitId="@string/dancinggirl">
</com.google.android.gms.ads.AdView>
尝试这种方式
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:ads="http://schemas.android.com/apk/res-auto"
tools:context="com.dancing.dance.girl"
android:background="@mipmap/vsdv">
<!-- TODO: Update blank fragment layout -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="2"
android:id="@+id/beauty_fragment"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2" >
<ImageButton
android:layout_width="0dp"
android:layout_height="fill_parent"
android:id="@+id/1"
android:layout_weight="1"
android:src="@drawable/lob"
android:background="@null"
android:scaleType="fitXY"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="5dp" />
<ImageButton
android:layout_width="0dp"
android:layout_height="fill_parent"
android:id="@+id/2"
android:layout_weight="1"
android:src="@drawable/lob"
android:background="@null"
android:scaleType="fitXY"
android:layout_marginTop="20dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2" >
<ImageButton
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="@drawable/lob"
android:background="@null"
android:scaleType="fitXY"
android:id="@+id/3"
android:layout_marginLeft="20dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="20dp"
android:layout_marginTop="5dp" />
<ImageButton
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="@drawable/lob"
android:background="@null"
android:scaleType="fitXY"
android:id="@+id/4"
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="5dp"
android:layout_marginBottom="20dp" />
</LinearLayout>
</LinearLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/abovebeauty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
ads:adSize="BANNER"
ads:adUnitId="@string/dancinggirl">
</com.google.android.gms.ads.AdView>
<com.google.android.gms.ads.AdView
android:id="@+id/beautyfragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/dancinggirl">
</com.google.android.gms.ads.AdView>