2013-02-02 3 views
2

나는이 문제를 해결할 수있는 답변을 찾지 못했습니다.Admob via Adwhirl : 광고를 게재 할 공간이 충분하지 않습니다! 원하는 : 480, 75, Has : 480, 0

내가 오류가! "광고를 표시 할 공간이 충분하지 않습니다 싶어 : 75 480 수 : 480, 0"

은 어떤 이유로 광고는 더 높이 사용할 수 있습니다 것으로 보인다.

는 Haxe NME에서 실행하고 내 전화는 안드로이드와의 HTC 하나 S (540x960)입니다 4.0.3 여기

자바 코드 :

public class AdWhirl 
{ 
public static RelativeLayout adLayout; 
public static GameActivity activity; 
public static String code; 

public static void init(String code) 
{ 
    AdWhirl.code = code; 
    activity = GameActivity.getInstance(); 

    activity.runOnUiThread(new Runnable() 
    { 
     public void run() 
     { 
      adLayout = new RelativeLayout(activity); 

      //Nothing works till this is set. 
      AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 5); 

      RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); 
      ViewGroup view = (ViewGroup) activity.getWindow().getDecorView(); 
      ViewGroup content = (ViewGroup) view.getChildAt(0); 
      content.addView(adLayout, p); 
     } 
    }); 
} 

public static void showAd(final int position) 
{ 
    if(activity == null) 
    { 
     return; 
    } 

    activity.runOnUiThread(new Runnable() 
    { 
     public void run() 
     { 
      AdWhirlLayout l = new AdWhirlLayout(activity, code); 
      l.setMaxHeight(75); //AdMob asks for this minimum height 

      RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); 

      //Bottom-Center 
      if(position == 0) 
      { 
       p.addRule(RelativeLayout.CENTER_HORIZONTAL); 
       p.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); 
      } 

      //Top-Center 
      else 
      { 
       p.addRule(RelativeLayout.CENTER_HORIZONTAL); 
       p.addRule(RelativeLayout.ALIGN_PARENT_TOP); 
      } 

      adLayout.addView(l, p); 
     } 
    }); 
} 

public static void hideAd() 
{ 
    if(activity == null) 
    { 
     return; 
    } 

    activity.runOnUiThread(new Runnable() 
    { 
     public void run() 
     { 
      adLayout.removeAllViews(); 
     } 
    }); 
} 
} 

답변

0

은 내가 할 수있는, 당신의 XML 레이아웃을 보지 않고 단지 짐작하지만, 다음과 같은 것을보고 당신의 XML을 원하는거야 : 당신은 아마 사용하고

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
    android:id="@+id/main_relative_layout_ad" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context=".GameActivity" > 

    <!-- Note the layout_above attribute, below --> 

    <TextView 
     android:id="@+id/textView" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:paddingBottom="10dp" 
     android:layout_above="@+id/adView" 
     android:gravity="center" 
     android:text="@string/your_text_here" /> 

    <!-- Note the alignParentBottom attribute, below --> 

    <com.google.ads.AdView 
     android:id="@+id/adView" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     ads:adSize="BANNER" 
     ads:adUnitId="YOUR_PUBLISHER_ID" 
     ads:loadAdOnCreate="true" /> 

</RelativeLayout> 

배치는 욕심 때문에 가능한 모든 공간을 빠는. layout_above을 사용하면 레이아웃이 강제로 광고를위한 공간을 남깁니다.

지원의 첫 번째 규칙은 GIGO임을 기억하십시오. 나쁜 또는 불완전한 정보는 198 번째 사람이 감히 대답을 추측하기 전에 귀하의 질문에 대한 197 번 견해에 의해 입증 된 것처럼, 나쁜 대답 또는 전혀 대답하지 않습니다.

관련 문제