Adding admob after a ListView in a RelativeLayout

1

Good Night!

I'm trying to add an admob to the end of a ListView in a RelativeLayout and the banner does not appear at all! I already tried to manipulate the layout in several ways to see if the ListView was not covering the admob, but it did not solve anything. can anybody help me?

Follow the xml below:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="16dp"
    android:paddingLeft="64dp"
    android:paddingRight="64dp"
    android:paddingTop="16dp"
    android:background="@drawable/background"
    xmlns:ads="http://schemas.android.com/apk/res-auto">

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_ad_unit_id">
    </com.google.android.gms.ads.AdView>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp"
        android:text="Suas Faltas"
        android:textColor="@color/white"
        android:textStyle="bold"
        android:textSize="25sp"
        android:layout_alignParentTop="true"
        android:id="@+id/textView2" />

    <ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_below="@+id/textView2"
        android:layout_alignParentStart="true"
        android:layout_marginTop="15dp" />

    <TextView android:id="@+id/vazio"
        android:text="Nenhuma matéria inserida"
        android:textColor="@color/white"
        android:layout_below="@+id/textView2"
        android:layout_alignParentStart="true"
        android:layout_marginTop="15dp"
        android:gravity="center"
        android:ems="10"
        android:layout_width="244dp"
        android:layout_height="42dp"/>


</RelativeLayout>
    
asked by anonymous 18.12.2017 / 04:02

1 answer

0

Try to use LinearLayout , see if this solution helps you.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/background"
    android:orientation="vertical"
    android:paddingBottom="16dp"
    android:paddingLeft="64dp"
    android:paddingRight="64dp"
    android:paddingTop="16dp">


    <TextView
        android:id="@+id/textView2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="5dp"
        android:text="Suas Faltas"
        android:textColor="#ffffff"
        android:textSize="25sp"
        android:textStyle="bold" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:gravity="center"
        android:layout_weight="1">

        <ListView
            android:id="@+id/list"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_alignParentStart="true"
            android:layout_marginTop="15dp" />

        <TextView
            android:id="@+id/vazio"
            android:layout_width="244dp"
            android:layout_height="42dp"
            android:layout_alignParentStart="true"
            android:layout_marginTop="15dp"
            android:ems="10"
            android:gravity="center"
            android:text="Nenhuma matéria inserida"
            android:textColor="#ffffff" />

    </RelativeLayout>

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_ad_unit_id"/>


</LinearLayout>
    
18.12.2017 / 12:41