The layout is simple, One WebView and a Banner(AD).
I wrote an XML like below:
<LinearLayout
android:id="@+id/banner_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"></WebView>
</LinearLayout>
And here's a code to create a banner runtime.
// This code is copied & pasted from AudienceNetwork's guide page
adView = new AdView(this, "PLACEMENT_ID", AdSize.BANNER_HEIGHT_50);
LinearLayout adContainer = (LinearLayout) findViewById(R.id.banner_container);
adContainer.addView(adView);
adView.loadAd();
This code won't work, the banner is displayed outside of the screen.
So, what I looking for is android:layout_height="match_parent - 50dp"
just like calc
in CSS.