Android Admob Position Top Of Screen Not Working
I am trying to integrate AdMob into my Android Application, and can get it to work fine in the simulator when using the default sample layout code to position AdMob at the bottom o
Solution 1:
If you always want to display on top of the screen then you may want to consider using RelativeLayout.
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="fill_parent"android:layout_height="fill_parent"><com.admob.android.ads.AdViewandroid:id="@+id/ad"android:layout_width="fill_parent"android:layout_height="wrap_content"app:backgroundColor="#000000"app:primaryTextColor="#FFFFFF"app:secondaryTextColor="#CCCCCC"android:layout_alignParentTop="true"
/><!-- TextView below that --><TextViewandroid:id="@+id/widget28"android:layout_width="fill_parent"android:layout_height="wrap_content"android:text="Input Amount:"android:layout_marginLeft="10dip"android:layout_marginTop="10dip"android:layout_marginRight="10dip"android:layout_below="@id/ad"android:textSize="16dip"android:textStyle="bold"></TextView></RelativeLayout>
Solution 2:
Make sure you are not scaling the emulator screen as this has caused me problems whereby the ads don't appear. I have also had to set the ads layout_height="50dip" to make sure the ads don't suddenly push the other Views (controls) down the screen and mess up the layout.
Post a Comment for "Android Admob Position Top Of Screen Not Working"