Orientation inverted on display with bigger width than height - android

I have a device on which I set portrait orientation, but it shows the activity in landscape. The device width is bigger than its height, so it seems to be inverted. What can I do to have this device working like the others?
Note that this device has a keyboard; see this image.

Related

Game won't Center on Landscape devices

My 2D project uses a 1:1 ratio to accommodate Portrait or Landscape. Stretch Mode is "viewport" and Aspect is "expand" to fit any device.
The GreenScreen Node fills that 1:1 space, so I reposition GrayButtons based on device orientation.
Both nodes are children of a Control anchored to Center Top:
Portrait works on all devices, and most devices handle Landscape correctly:
The GreenScreen automatically centers itself in the Center Top as desired for either rotation:
However on only some Android devices, it won't center. It aligns GreenScreen to the top left corner so half the buttons are offscreen:
How can I always center the game on any device?

screen size set in Game View does not match the display area in Scene View and Game View. : Unity2D

16:9 portrait
But screen ratio is not 16:9.
And the left and right sides of the screen are not displayed.
16:9 Landscape
More like a square than 16:9.
18:9 Portrait
1920x1080 Portrait
same as them.
I suspected the camera rotation.
But there was no problem.
Camera rotation was 0 in xyz.
Why?
My enviroments:
Windows10
Unity2020, 2021(After I have this problem in 2020, I upgraded 2020 to 2021.)
build setting: android

Set different wallpaper for portrait and landscape android

I am trying to set a wallpaper, When i view it in Portrait mode then it actually sets what i see, but when i switch to landscape mode a bit gets cropped.
When i view it in landscape mode and then switch to portrait my image shifts upwards leaving a black border of about 150px because i switched from landscape to portrait.
This is because the viewport of a phone being 1920x1920 instead of the actual used size of 1080x1920.
Is it possible to set a different wallpaper for each view (either landscape or portrait) ? without using a live wallpaper.
the viewport size is being retrieved using mWallpaperManager.getDesiredMinimumWidth() and mWallpaperManager.getDesiredMinimumHeight() where mWallpaperManager is an instance of WallpaperManager.

Android, get screen size in api 3.2

In API 3.2 when you get the screen height, it seems that return value is the screen height minus the height menu bar.
Here is the code:
((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(metrics);
int height=metrics.heightPixels;
For API 3.2 emulator with 1280x800 screen size, the height return is 752
I tried to get the height with methods but always return 752
Ok I get the answer. In API 3.2 you need to get height and width in onSurfaceChanged method. If you need to get the real values you need to get height and width in portait and landscape mode and select the non reduced measure in both modes.

Android App Widget Size

How can specify different height and width for an android app widget in potrait and landscape mode.
The cells on a home screen are roughly 72dp in height and width so you shouldn't need to.

Categories

Resources