android - Ads Don't fill up the entire screen -
here's xml file,
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:layout_width="match_parent" android:layout_height="462dp" android:background="#ffffff" android:gravity="top" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".quotes" > <imagebutton android:id="@+id/fprev" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_aligntop="@+id/previous" android:layout_torightof="@+id/previous" android:background="@drawable/btn333" android:contentdescription="@drawable/radnom" android:src="@drawable/eback" /> <imagebutton android:id="@+id/copy" style="@style/imagebuttonpr2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbottom="@+id/fprev" android:layout_centerhorizontal="true" android:background="@drawable/btn222" android:contentdescription="@drawable/copy" android:src="@drawable/copy" /> <relativelayout android:id="@+id/relativelayout2" android:layout_width="match_parent" android:layout_height="175dp" android:layout_centerinparent="true" android:background="@drawable/quotess" > <textview android:id="@+id/quotes" android:layout_width="300dp" android:layout_height="215dp" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:alpha="1" android:background="@android:color/transparent" android:gravity="center_vertical|center_horizontal|top|bottom" android:inanimation="@android:anim/fade_in" android:outanimation="@android:anim/fade_out" android:text="@string/h2" android:textsize="12sp" android:typeface="monospace" /> </relativelayout> <imagebutton android:id="@+id/previous" style="@style/imagebuttonpr" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignleft="@+id/relativelayout2" android:layout_below="@+id/relativelayout2" android:layout_margintop="14dp" android:contentdescription="@drawable/previous" android:src="@drawable/previous" /> <imagebutton android:id="@+id/fjprev" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_aligntop="@+id/copy" android:layout_torightof="@+id/copy" android:contentdescription="@drawable/btn4" android:src="@drawable/eforward" /> <imagebutton android:id="@+id/next" style="@style/imagebuttonapptheme" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignright="@+id/relativelayout2" android:layout_aligntop="@+id/fjprev" android:background="@drawable/btn4444" android:contentdescription="@drawable/next" android:src="@drawable/next" /> <edittext android:id="@+id/nm" android:layout_width="30dp" android:layout_height="20dp" android:layout_alignright="@+id/next" android:layout_below="@+id/next" android:background="#cdcdcd" android:ems="10" android:inputtype="number" android:text="@string/h3" android:textcolor="#ffffff" /> <textview android:id="@+id/tview1" android:layout_width="match_parent" android:layout_height="50dp" android:layout_above="@+id/relativelayout2" android:layout_centerhorizontal="true" android:background="@drawable/highlight" android:gravity="center|center_vertical" android:text="@string/h1" android:textappearance="?android:attr/textappearancemedium" android:textcolor="@android:color/white" /> <com.google.ads.adview android:id="@+id/adview3" android:layout_width="match_parent" android:layout_height="wrap_content" ads:adsize="banner" ads:adunitid="****" ads:loadadoncreate="true" > </com.google.ads.adview> </relativelayout>
when run app, first problem ads dont show in portrait. , when switch landscape, ads don't cover topmost region of app's screen. can done? tried using smart_banner got error, not enough space in both orientations.
it's because haven't specified location in relative layout. try this:
<com.google.ads.adview android:id="@+id/adview3" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" ads:adsize="banner" ads:adunitid="****" ads:loadadoncreate="true" > </com.google.ads.adview>
Comments
Post a Comment