Skip to content

Instantly share code, notes, and snippets.

@brandhill
Last active June 15, 2020 13:43
Show Gist options
  • Save brandhill/928013d0fa5f591e4581a33bf10fca43 to your computer and use it in GitHub Desktop.
Save brandhill/928013d0fa5f591e4581a33bf10fca43 to your computer and use it in GitHub Desktop.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_layout);
// fixing portrait mode problem for SDK 26 if using windowIsTranslucent = true
if (Build.VERSION.SDK_INT == 26) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment