Reputation: 631
now i am working to create an android application that this application use HTML5Webview for play video. I download HTML5webview from this https://code.google.com/p/html5webview/
Now, i want to add admob banner in this application. But, i have a problem when do it. My ads not show because "Not enough ad space". SS Error Message : http://prntscr.com/3lk1t0
In Html5web view, the layout use FrameLayout. I think, the problem is about layout. I search other reference to add admob in FrameLayout, but all reference use RelativeLayout.
How to resolve this problem?
this is my xml layout :
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:id="@+id/fullscreen_custom_content"
android:visibility="gone"
android:background="@color/black"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<com.google.android.gms.ads.AdView android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="0dp"
android:paddingRight="0dp"
ads:adSize="BANNER"
ads:adUnitId="*****"/>
</LinearLayout></FrameLayout>
and this is my activity class,you can see via dropbox ->
Klik for Activity class
My question is, how to add admob if my code like that.? Thanks before.
Upvotes: 0
Views: 137
Reputation: 20196
You have several problems with this layout.
</FrameLayout>
tag.wrap_content
and add a layout_weight="1"
attribute to cause the LayoutManager to expand the element to fill any unused space so that your WebView takes up any space not used by the AdView.Ie like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<com.google.android.gms.ads.AdView android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="0dp"
android:paddingRight="0dp"
ads:adSize="BANNER"
ads:adUnitId="*****"/>
</LinearLayout>
Upvotes: 1