I try to make android app with AdMob.
I create the admob adView as described in documentation:
FrameLayout layout = (FrameLayout) findViewById(R.id.frame_layout);
adView = new AdView(this, AdSize.SMART_BANNER, myAdMobId );
Then, if I run my app on a device 320×480 (phone), the advert banner appears on the top, but if I run my app on a android tablet 1280×800, the advert banner appears centered horizontally and vertically – at the center of screen.
Also, I tried AdSize.BANNER, AdSize.IAB_BANNER, AdSize.IAB_LEADERBOARD – result is the same.
What I am doing wrong?
UPD1. res/layout/main.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/frame_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.mysite.myapp.GameView
android:id="@+id/game"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</FrameLayout>
This should do the trick.
in what you did in the xml, you didn’t specify any gravity.