2014-02-24 9 views
0

작은 화면에 AdMob 배너를 표시하는 데 문제가 있습니다 (가로 모드 사용 중). Galaxy S4에서 테스트 한 결과 광고는 표시되지만 작은 화면에서는 가로 모드로만 표시됩니다. 나는 match_parent, wrap_content 및 fill_parent에 대한 xml 레이아웃 매개 변수 (너비와 높이)를 변경하려고 시도했지만 여전히 똑같은 작업을 수행했습니다.AdMob 배너를 표시 할 공간이 충분하지 않음 (Android)

오류 스택 추적 : 02-24 16 : 30 : 36.327 : 광고/광고 (396) : 광고를 표시 할 공간이 부족합니다. 320x50 픽셀이 필요하지만 208x239 픽셀 만 있습니다.

내 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:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@raw/backgroundc" 
    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=".MainActivity" > 

    <Button 
     android:id="@+id/buttonGetLuck" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_centerVertical="true" 
     android:background="@layout/get_luck_custom_button" 
     android:onClick="buttonGetLuck" 
     android:text="Get Lucky" 
     android:textStyle="italic" 
     android:typeface="sans" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="16dp" 
     android:text="See your luck for today." 
     android:textColor="#7CFC00" 
     android:textSize="18sp" 
     android:textStyle="italic" 
     android:typeface="serif" /> 

    <LinearLayout 
     android:id="@+id/bannerLayuout" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:orientation="horizontal" 
     android:layout_centerHorizontal="true"/> 

</RelativeLayout> 

내 코드는 다음과 같습니다

// Create the adView. 
    adView = new AdView(this); 
    adView.setAdUnitId("*******"); 
    adView.setAdSize(AdSize.BANNER); 

    // AdMob banner layout 
    LinearLayout layout = (LinearLayout)findViewById(R.id.bannerLayuout); 

    // Add the adView to it. 
    layout.addView(adView); 

    // Initiate a generic request. 
    AdRequest adRequest = new AdRequest.Builder().build(); 

    // Load the adView with the ad request. 
    adView.loadAd(adRequest); 
+0

사용 조각 ... –

+0

나는 또한 AdSize와 testet 한이 라인을 제거하는

시도 .SMART_BANNER하지만 여전히 작동하지 않습니다 ... – Balflear

+0

보기를 볼 수 없으며 확실해야합니다. 상위 뷰에 ScrollView를 추가해보십시오. 그러면 하위 뷰가 화면에서 밀려나는지 확인할 수 있습니다. 제 생각에 레이아웃의 문제가 바로 지금 무엇입니까 –

답변

1

내가 문제가 부모 뷰 "패딩"될 수 있다고 생각합니다.

안드로이드 : paddingLeft = "@ DIMEN/activity_horizontal_margin" 안드로이드 : paddingRight = "@ DIMEN/activity_horizontal_margin"