Android | Getting screen height as width and screen width as height
问题 I have the following piece of code in my app to get screen width and height: screenHeight = (short) Activity.getWindow().getWindowManager().getDefaultDisplay().getHeight(); screenWidth = (short) Activity.getWindow().getWindowManager().getDefaultDisplay().getWidth(); And in the AndroidManifest, I have: <activity android:name="com.test.MyActivity" android:configChanges="keyboardHidden|orientation" android:launchMode="singleTask" android:screenOrientation="landscape" android:theme="@android