[英]Android Ad: Landscape Vs. Screen Auto-rotate
I am developing an app of which all environment are in landscape. 我正在开发一个所有环境都完美的应用程序。
<activity
android:name=".Main"
android:screenOrientation="landscape"/>
public class Startup extends Activity implements AdListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
interstitialAd = new InterstitialAd(this, MY_PUBLISHER_ID); // Create an ad.
interstitialAd.setAdListener(this); // Set the AdListener.
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
interstitialAd.loadAd(adRequest);
The Ad loads, but does not appear properly; 广告已加载,但显示不正确; there is a lot of white blank space at the bottom of the screen (under the ad), and it seems the ad is in portrait mode but chopped as shown below: 屏幕底部(广告下方)有很多白色空白,看来广告处于纵向模式,但如下所示切碎:
However, I discovered that if I GO OUTSIDE the app and set the system screen to be able to SCREEN AUTO_ROTATABLE
, then the ad can be displays properly like below: 然而,我发现,如果我去外面的应用程序和设置系统屏幕能够SCREEN AUTO_ROTATABLE
,那么广告可以正常显示如下图所示:
I believe interstitialAd
could support landscape? 我相信interstitialAd
可以支持景观? But how could that be modified? 但是,如何修改呢?
If the interstitialAd
cannot be modified, how can I force the system to set SCREEN AUTO_ROTATABLE
to indirectly solve the problem? 如果无法修改interstitialAd
,如何强制系统设置SCREEN AUTO_ROTATABLE
来间接解决问题?
It sounds like this should be configured on the server side as mentioned here: https://developers.google.com/mobile-ads-sdk/docs/dfp/advanced 听起来这应该在服务器端进行配置,如下所述: https : //developers.google.com/mobile-ads-sdk/docs/dfp/advanced
There is no need to define a separate ad unit for landscape mode. 无需为横向模式定义单独的广告单元。 You can simply add the landscape size (eg 480x320 for smartphones) to line items targeting the interstitial ad unit and include a creative with the landscape size in addition to the regular portrait size. 您只需将横向尺寸(例如,智能手机的480x320)添加到定位插页式广告单元的订单项,即可在常规肖像尺寸之外添加具有横向尺寸的广告素材。
I don't have access to DoubleClick for Publishers so I can't verify if that would work. 我无权使用DFP广告管理系统,因此无法验证是否可以使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.