When rotating an Android device into Landscape mode, it can be in 2 different positions, from the device's perspective, the bottom buttons could be either on the left or on the rig开发者_如何学编程ht. Is there a way to differentiate between these 2 modes? Either via onConfigurationChanged or via View.onSizeChanged I get the same result (obviously) as the device is on Landscape and the resolution is the same (800x480 in my case) for both "modes".
Thanks
This will get the screen orientation:
Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int orientation = display.getRotation();
Then you can check it like this:
if(orientation == Surface.ROTATION_90) {
// do something
} else if (orientation == Surface.ROTATION_270) {
// do something else
}
精彩评论