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
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?
– Wakim
modified la ta good
– Ilgner de Oliveira
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 theListView
and ofAdView
. If you are going to use a Linearlayout, just use theheight="0dp"
andlayout_weight="1"
in theListView
, theAdView
remains the same.– Wakim
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
– Ilgner de Oliveira
put an image
– Ilgner de Oliveira