现在我的工作创造一个Android应用程序,这个应用程序使用HTML5Webview用于播放视频。我从这个的https://$c$c.google.com/p/html5webview /
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/
现在,我想补充AdMob的横幅在此应用程序。但是,我有一个问题时,做到这一点。我的广告没有表明,由于没有足够的广告空间。 SS错误消息: http://prntscr.com/3lk1t0
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
在Html5web看来,布局中使用的FrameLayout。我认为,这个问题是关于布局。我搜索其他参考AdMob的添加在的FrameLayout,但都参考使用RelativeLayout的。
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.
如何解决这个问题呢?
这是我的XML布局:
<?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>
这是我的活动课,你可以通过Dropbox的看到 - > 的点击的活动类 我的问题是,如何添加AdMob的,如果我的code类的?谢谢你了。
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.
您有几个问题与此布局。
You have several problems with this layout.
您必须在外层多个布局。您应该只有一个。摆脱第一的FrameLayout元素。 您完成与结束的FrameLayout标签,匹配什么都没有。这使得XML结构无效,就没有办法,该机器人的LayoutManager会加载此布局。除去最后的&LT; /的FrameLayout&GT;
标记
您已经指定了的LinearLayout作为match_parent的高度。这告诉布局管理有该元素消耗所有其父的高度。这就是为什么没有空间的AD浏览报。将其更改为 WRAP_CONTENT
并添加 layout_weight =1
属性,以使布局管理,扩大元素来填充任何未使用的空间,这样的web视图占用不使用AD浏览的任何空间。
You have multiple layout at the outer level. You should only have one. Get rid of the first FrameLayout element.
You finish with a end FrameLayout tag, that matches nothing. This makes the XML structure invalid, there is no way that the Android LayoutManager would have loaded this layout. Remove the final </FrameLayout>
tag.
You have specified the height of the LinearLayout as match_parent. This tells the LayoutManager to have that element consume all of the height of its parent. That is why there is no room for the AdView. Change it to 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.
即是这样的:
<?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>