2012-03-28 1 views
1

ここは私のXMLスクリプトです。私は私のvideoviewのontopの広告をどのように表示するかを理解しているようだ。以下は私のXMLコードです。XMLを使用してVideoviewの上部にAdmob広告を追加するにはどうすればよいですか?

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/res/com.gallery.video" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:gravity="bottom" > 

    <com.google.ads.AdView 
    android:id="@+id/adView" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    ads:adSize="BANNER" 
    ads:adUnitId="myid" 
    android:gravity="top" /> 


    <VideoView android:id="@+id/VideoView" 
      android:layout_width="fill_parent" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentTop="false" 
      android:layout_alignParentBottom="false" 
      android:layout_height="wrap_content"> 
    </VideoView> 
</RelativeLayout> 

現在はこの

http://img442.imageshack.us/img442/563/img1nve.jpg

のように見せているが、私はそれを助けてください、この

http://img854.imageshack.us/img854/1614/img2bv.jpg

のようになりたいです。 thanks

答えて

1

このバージョンをお試しください。不要なアトリビュートを取り出し、AdMob広告を画面上部に合わせて、android:layout_aboveアトリビュートを使用して広告の下に動画を設定しました。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/res/com.gallery.video" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <com.google.ads.AdView 
     android:id="@+id/adView" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     ads:adSize="BANNER" 
     ads:adUnitId="myid" 
     android:layout_alignParentTop="true" /> 

    <VideoView android:id="@+id/VideoView" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_above="@id/adView" /> 
</RelativeLayout> 
1

VideoViewタグにandroid:layout_weight = "1"プロパティを追加する必要があります。次のコードを参照してください:

<VideoView android:id="@+id/VideoView" 
      android:layout_width="fill_parent" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentBottom="true" 
      android:layout_height="fill_parent" 
      android:layout_weight="1"> 
    </VideoView> 

私はこれがあなたを助けてくれることを願っています。

+0

Thanks NewBi。しかし、それはどちらかといえばうまくいかないようです。 :) –

関連する問題