2013-05-07 2 views
3

:DoubleClick - 삽입 광고 크기 조정/자르기/가운데 놓기 -> 불가능합니까? 이 코드 (<a href="https://developers.google.com/mobile-ads-sdk/docs/admob/advanced" rel="nofollow">https://developers.google.com/mobile-ads-sdk/docs/admob/advanced</a>) 다음

import com.google.ads.*; 

public class BannerExample extends Activity implements AdListener { 

    private InterstitialAd interstitial; 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.main); 

    // Create the interstitial 
    interstitial = new InterstitialAd(this, MY_INTERSTITIAL_UNIT_ID); 

    // Create ad request 
    AdRequest adRequest = new AdRequest(); 

    // Begin loading your interstitial 
    interstitial.loadAd(adRequest); 

    // Set Ad Listener to use the callbacks below 
    interstitial.setAdListener(this); 
    } 

    @Override 
    public void onReceiveAd(Ad ad) { 
    Log.d("OK", "Received ad"); 
    if (ad == interstitial) { 
     interstitial.show(); 
    } 
    } 
} 

내 휴대 전화 화면보다 작은 이미지 (내가 광고)가 있습니다. 자바 코드로 생성 된 뷰의 크기를 조정할 수 있는지 알고 싶습니다. (onCreate() 또는 onReceiveAd()에서) 광고 크기를 조정합니다.

보기의 예를 들어 CenterCrop의 LayoutParam 또는보기의 단순 크기 조정!

답변

2

DFP에서 전화로 삽입 광고를 게재하려는 경우 DFP에서 이미지를 설정하고 크기를 320x480으로 재정의 할 수 있습니다. 그런 다음 해당 광고 소재가 게재 될 수 있으며 원하는 경우 작아 질 수 있습니다.

또는 전체 화면을 차지하는 삽입 광고 오버레이 대신 배너를 찾고있을 수 있습니다. 이 경우 AdView에 specify a custom size을 입력 할 수 있으며 이는 DFP에서 설정 한 크기와 일치해야합니다.

+0

나는 또한 둘러 보았고 화면에 광고 소재의 적절한 크기를 얻기위한 해결책을 찾았습니다. 내 화면은 1080px x 1920px입니다. 실제 디스플레이는 기본 화면에서 오프셋되었습니다. – GFxJamal