3
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 또는보기의 단순 크기 조정!
나는 또한 둘러 보았고 화면에 광고 소재의 적절한 크기를 얻기위한 해결책을 찾았습니다. 내 화면은 1080px x 1920px입니다. 실제 디스플레이는 기본 화면에서 오프셋되었습니다. – GFxJamal