开发者

Android: Pressing ad causes Activity with locked orientation to change orientation

All of the Activities in my app are locked into portrait orientation using:

android:screenOrientation="portrait"

I have ads showing at the top of a few of my Activities, and if I tilt the phone sideways and press the ad, it changes the underlying Activity into landscape orientation! I tried to override

onConfigurationChanged(Configuration newConfig)

by se开发者_Python百科tting the configuration to portrait and calling through to super, but it has no effect. Any clue on how to fix this, or what's going on?


    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);

        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

Did the trick.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜