0

我已成功在我的 android 应用程序中集成了 vungle 视频广告,但广告仅以横向模式显示,但我希望广告以纵向模式显示。

我在清单文件中完成了以下实现

 <activity
 android:name="com.vungle.publisher.FullScreenAdActivity"
 android:configChanges="keyboardHidden|orientation|screenSize"
 android:screenOrientation="portrait"
 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>

还有我的活动:

<activity
            android:name=".CreateGame"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden|adjustPan" />

我按照这个网址设置了 vungle 广告 https://github.com/Vungle/vungle-resources/blob/master/English/Android/current-release/android-dev-guide.md

在我的 CreteGame Activity 中,我遵循了以下代码

在 onCreate 方法中我做了这件事:

  protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.creategame);
            final String app_id = "App_id";

            // initialize the Publisher SDK
            vunglePub.init(this, app_id);
        }  

我在我的函数()中遵循了以下编码

final AdConfig globalAdConfig = vunglePub.getGlobalAdConfig();

             globalAdConfig.setOrientation(Orientation.autoRotate);
             globalAdConfig.setOrientation(Orientation.matchVideo);
            if(!vunglePub.isAdPlayable()) {
                return;
            }
            else{
                vunglePub.playAd(globalAdConfig);

            }

请帮助我仅在纵向视图中显示广告在此先感谢

4

1 回答 1

0

您应该删除:

globalAdConfig.setOrientation(Orientation.matchVideo);

只留下:

globalAdConfig.setOrientation(Orientation.autoRotate);

如果您以纵向方式手持设备,它将以纵向方式显示广告。“matchVideo”应该主要以横向模式显示。

谢谢,

于 2015-12-19T00:33:05.607 回答