android - How to show advertisements in my Activity? -
i want put advertisement in application. set advertisement layout size. problem when run application in device, advertisement layout size decrease or increase depending on device height.
i have multiple layout in screen gave weight property weight increase or decrease.
here, xml layout in set layout advertisement:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/main_background" android:orientation="vertical" > <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:layout_weight="0.09"> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:background="@color/spinner_bg_color" android:layout_margintop="5dp"> <spinner android:id="@+id/spinner" android:layout_width="fill_parent" android:layout_height="wrap_content"> </spinner> </linearlayout> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="10dp"> <listview android:id="@+id/lst_player" android:layout_width="fill_parent" android:layout_height="wrap_content"/> </linearlayout> </linearlayout> <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/main_background" android:layout_weight="0.65"> <framelayout android:id="@+id/adbar" android:layout_width="fill_parent" android:layout_height="fill_parent"> </framelayout> </linearlayout> </linearlayout>
the advertisement loaded problem layout height.
how set layout height advertisement activity has more 1 or 2 layouts?
please, me solve issue.
remove framelayout
last inner linearlayout
, assign width match_parent
, height wrap_content
. assume add ads programmatically adbar don´t forget set adview smart_banner.
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/main_background" android:orientation="vertical" > <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:background="@color/spinner_bg_color" android:layout_margintop="5dp"> <spinner android:id="@+id/spinner" android:layout_width="fill_parent" android:layout_height="wrap_content"> </spinner> </linearlayout> <linearlayout android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:layout_margintop="10dp"> <listview android:id="@+id/lst_player" android:layout_width="fill_parent" android:layout_height="wrap_content"/> </linearlayout> <framelayout android:id="@+id/adbar" android:layout_width="match_parent" android:layout_height="wrap_content"> </framelayout> </linearlayout>
hope helps!!
Comments
Post a Comment