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.
精彩评论