2016-11-24 38 views
1

移动广告上的布局顶端的广告不会被放置在顶部布局,像广告放置在底部。它不是重叠布局。发生在安卓

这里是布局的形象,我在说一下,看看 Image of the layout

这里是它

<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> 

三江源的XML代码的看着它。

+0

加上'机器人:layout_below = “abovebeauty”'在'beauty_fragment'的LinearLayout –

+0

使用frameLayout – SaravInfern

+0

@Ankur你见过吗? e图像?,我需要它重叠,就像在图像中放置在屏幕底部的广告一样。 – Sarthakpandit

回答

0

尝试这种方式下面的LinearLayout

<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> 

+0

谢谢你的工作。 – Sarthakpandit

+0

如果有帮助,请接受答案:) – Redman

1

认沽广告布局

<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> 

+0

您发布了和我一样的答案-_- – Redman

+0

那么,这是正确的解决方案,我也写在同一时间 –

+0

谢谢你的工作。 – Sarthakpandit