I am developing an app supported by smartphones and tablets. For smartphones, the screen orientation is set to portrait (in the Manifest) and for tablets the orientation is changed to landscape programatically.
The problem: If I change the orientation programatically the activity's enter animation that I set before with the Intent disappears. How can I keep the screen animation?
I have also tried to override the screen animation inside onCreate
:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
this.phone = getResources().getBoolean(R.bool.portrait_orientation);
if(phone){
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}else{
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
getWindow().getAttributes().windowAnimations = R.style.Animation_activity_slide_left;
}
}
Manifest tags for the activity:
android:configChanges="orientation|locale|layoutDirection|screenSize|keyboardHidden"
android:screenOrientation="portrait"
Thanks in advance!
To solve this issue I removed the screenOrientation="portrait
from the manifest and I handled the orientation only programatically in on activity's onCreate