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
Post a Comment