ListView on TOP of Ads - Android -


i'm having troubles showing ads on bottom of listview, on main activity ads works, difference there use viewpager instead of listview.

this layout:

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent" >      <com.google.ads.adview         xmlns:app="http://schemas.android.com/apk/lib/com.google.ads"         xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"         android:id="@+id/adview"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         ads:loadadoncreate="true"         android:background="#313131"         app:adsize="smart_banner"         app:adunitid="my_id" />      <listview         android:id="@id/android:list"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_above="@id/adview" />  </relativelayout> 

the listview shows on top of ads , of course can't clicked, same layout works viewpager.

another way.

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" >  <listview     android:id="@id/android:list"     android:layout_width="match_parent"     android:layout_height="match_parent"    />  <com.google.ads.adview     xmlns:app="http://schemas.android.com/apk/lib/com.google.ads"     xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"     android:id="@+id/adview"     android:layout_width="match_parent"     android:layout_height="wrap_content"     ads:loadadoncreate="true"     android:background="#313131"     app:adsize="smart_banner"     app:adunitid="my_id" />  </linearlayout > 

when ad - loaded, height. listview bottommargin = adheight , ad topmargin = (-1)*adheight. try it.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -