2012-03-28 8 views
1

여기 내 XML 스크립트입니다. 내 동영상보기의 admob 광고 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

android : layout_weight = "1"속성을 VideoView 태그에 추가해야합니다. 다음 코드를 참조하십시오.

<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

감사 NewBi. 하지만 그 중 하나가 작동하지 않는 것 같습니다. :) –

관련 문제