Android: Restrict activity orientation based on screen size
问题 I have an app that looks good in either orientation on a large or xlarge screen size, but should be restricted to portrait on phones. I know that you can restrict the orientation of an Activity in the manifest, but is there a way to do so conditionally? Or is there some kind of property I can set in the activity itself to choose which orientations are supported? 回答1: This is the solution I use in my apps: public void onCreate(Bundle savedState) { //... if(isScreenLarge()) { // width > height,