Reputation: 135
I should put an element (AdMob) at the top of a WebView, so when the WebView scrolls, the adv (AdMob) doesn't stay at the top of the page but scrolls with the page. Is it possible? If not, how can I do this?
Thanks!
PS: I'm Italian, sorry for any error :|
Upvotes: 0
Views: 336
Reputation: 30557
This can be done if you seprate the AdMob View and WebView and put them in a parent container such as a LinearLayout, and then place that layout in a ScrollView:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="MY_AD_UNIT_ID"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
ads:loadAdOnCreate="true"/>
<WebView
android:id="@+id/webView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
</ScrollView>
Upvotes: 1