Advertising error

Asked

Viewed 49 times

0

I’m trying to put advertising in my application, my application has two screens the first screen I managed to put like this

telainicial.xml

<com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        ads:adSize="SMART_BANNER"
        ads:adUnitId="@string/banner_unit_id"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true">
    </com.google.android.gms.ads.AdView>

telainicial.java

AdView mAdView =  ( AdView ) findViewById ( R . id . adView );
        AdRequest adRequest =  new  AdRequest . Builder (). build ();
        mAdView . loadAd ( adRequest );

So it works on the first screen I copied and pasted on the second screen the same code and is only getting the advertising space

xml complete

<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="wrap_content"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:background="#ffffff"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context=".MainActivity">


    <ListView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/praias"
        android:layout_centerHorizontal="true"
        android:layout_above="@+id/adView" />

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        ads:adSize="SMART_BANNER"
        ads:adUnitId="@string/banner_unit_id"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true">
    </com.google.android.gms.ads.AdView>
</RelativeLayout>

It’s all coming out, more where the publicity should be getting a white hole

inserir a descrição da imagem aqui

  • Could Ilgner include the xml of your second screen? When you say, "is just getting the advertising space", it means that other views do not appear?

  • modified la ta good

  • 2

    In this layout, does advertising not appear? Or does it appear and Listview does not? I would recommend using a LinearLayout because it would be much simpler to set the height of the ListView and of AdView. If you are going to use a Linearlayout, just use the height="0dp" and layout_weight="1" in the ListView, the AdView remains the same.

  • the more the listview is appearing normal , and the advertising that does not appear , she does not charge the space of her is la normal

  • put an image

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.