Android emulator upside down - android

I am using Titanium to build an app. I created an android emulator using a standard device definition Nexus 4 (4.7", 768X1280: xhdpi, Android 4.1.2 - APU Level 16 , ARM (armebi-v7a) when I run it , the outside orientation appears correct but the screen itself is upside down. See image:
! [upside down emulator] (http://www.tiikoni.com/tis/view/?id=c0d737c)
I have deleted the emulator and re-created it a couple of times. I chose this one as it appears to have the highest screen density and the smallest screen physical size. Is there a way to fix this? when my app runs, it does appear correctly, but using the emulator is weird. Loke for opening the app drawer, you don't click on the icon where it is displayed, but you click where it should be.

Unchecking the "Use Host GPU" corrects the situation. I do not know why, but it does.

Try left Ctrl + F12. to rotate emulator.
also refer

The fix to this for me was very simple. I entered the resolution as height x width and it was upside down. So I entered width x height and it became OK.

Please check your XML and set proper background to the parent view.

Related

Strange work of getDisplayMetrics()

I'm writing a small application and I ran into the following problem.
When measuring the screen height in pixels, FullHD screen gives out 1920px, and FullHD + screen (2160px) gives out 2030px. What could be the problem? And is there a way to solve it without crutches (ha-ha)?
FullHD:
getContext().getResources().getDisplayMetrics().heightPixels;
>> W/Height of screen: 1920
FullHD+:
getContext().getResources().getDisplayMetrics().heightPixels;
>> W/Height of screen: 2030
Perhaps the problem is that the FullHD screen I ran in the emulator, but FullHD + is native in Xiaomi Mi Mix 2s, but in any case, it does not solve the problem.
UPD: Yes, in emulator FullHD+ screen gives out all 2160px. I'm confused.
The size returned by this method (getContext().getResources().getDisplayMetrics().heightPixels)does not necessarily represent the actual raw size of the display.It could include the height of the statusbar,and sometimes not depending on the mobile system.
You can get the actual height of the activity window by the method getWindowsManager().getDefaultDisplay().getRealmetrics(metrics) which includs the statusbar always.

Xamarin, Android: Lock Aspect Ratio to 16:9

We are working on an app that mainly uses either Framelayouts or Linearlayouts.
In our app, we provide 5 different folders with drawables, from mdpi to xxxhdpi.
Working with weights or DisplayDimensions made our app look the exact same on basically every smartphone device.
Every smartphone device, but one. The Samsung S8.
The problem is as seen below:
This is the main menu on almost any other device (S3, S4, S5, S6 -Edge, S7 - Edge)
This right here, is a screenshot of the mainmenu on the S8:
.
Removing the bottom buttons and displaying the app in fullscreen makes this even worse!
So what is going on here?
Simple - the S8 uses the same width (1440px) as the S7 for instance, but yet its screen is higher. Increasing the screen height without the width changes the aspect ratio.
While most smartphones use a ratio of 16:9, the S8 is somewhere at 20.5:9 I believe. Ergo: The screen DO NOT look the way they are supposed to.
Now theres gotta be a solution to that, which won't have us redisign almost every activity to ALSO fit the s8.
What optins are there?
Is there maybe an option in VISUAL STUDIO, to "lock" the aspect ratio to 16:9 and display maybe a black bar on top instead of streching the layout?
I hope you guys can help us! That'd be great!
Thank you!
Btw: I noticed that the apps that we made in unity which are usually games DO look the same. There the aspect ratio is maintained and a black bar is shown on the sides. This I hope, is possible for Visual Studio?
I have found a workaround, that is pretty easy.
if (Resources.DisplayMetrics.HeightPixels >= 2560)
{
intHeightOfDisplay = 2560;
}
else
{
intHeightOfDisplay = Resources.DisplayMetrics.HeightPixels;
}
Basically saying, that if the height of the display is heigher than "most phones" I just set it to the maximum height of my app. This works pretty much everywhere.

Android Studio and a 4:3 resolution

My most resend project involves a Samsung Tab A 9.7" with 1024x768 pixels in a 4:3 format. This tablet is quite new and this format is unfortionatelly not supported by Android Studio so I've tried adding a new virtual device with these resolutions. I've set the scale option to: '1dp on device = 1px on screen'
The thing that seems wrong, is there is a difference between dp and px. If, for example, the width of a view is set to 1024px, it lines up nicely with the borders of the screen. But if I set it to 1024dp, it is much smaller... 1dp=1px means it is supposed to be the same, right?
When I launch it on the tab, all content gets wrong sizes etc (due to the problem above ofc).
Is there a way to propper add a 4:3 resolition so it can be used in the layout editor? I know there is a difference between px and dp but 1/1 is supposed to be the same?
Thanks a lot,
Jesse
After a long mixture between research and trail and error, finally 'found' the cause. When adding a virtual device in android studio for a custom resolution, it automatically focuses on portrait mode I think. Putting a view till the middle in portrait mode inside the editor -> In the middle in landscape on the tablet. Not sure if this is mend to be or an error of some kind.
Found out you can use the Nexus 9 layout, also 4:3 (2048 x 1538).
Thanks for the support Nanoc

Forcibly run android emulator in landscape mode

I need to run emulator with size 1366x768 in landscape mode. But when I launch emulator, it automatically changes into portrait mode, but with same scale (height is 1366, width is 768, but I need otherwise). So, changing mode by pressing CTRL + F12 don't helps, because after changes, proportions stay the same. Any suggestion?
You may try Genymotion, fast, supports rotation and sensors too.
http://www.genymotion.com/
For Windows OS:
Run your emulator and press Number 9.By pressing Number "9". You can toggle from landscape to portrait and portrait to landscape. I hope you get it now. Here is an image which Number 9 you need to press:
For Linux:
You should use Left Ctrl + F12. It'll work for sure.
I am not sure about this, But you can try. Use NUMPAD 7 followed by NUMPAD 9.
For more information , Go Here
Also You need to see This link
Let me know if it helped. Thanks.
To force landscape mode boot-up, edit the device's configuration file to force the height and width settings.
Open this file for edit in a text editor:
C:\Users\<user>\.android\avd\<deviceName>.avd\hardware-qemu.ini
Switch the values of the width and height, so that the width is longer than the height:
hw.lcd.width = 800
hw.lcd.height = 480
The AVD now boots in Landscape mode. The orientation may still be changed with shortcut keys.

Android Emulator actual screen size

I want to optimize my app. I have a user with a Samsung Galaxy Note, 1280x800, 320dpi, Large Screen.
How do I set up the emulator's actual inch-screen size?
If I choose WXGA800 with 320dpi it makes a normal sized Version. How do I make it large?
Edit. Thanks for your answers, but that isn't the point. I know how to set up a an Emulator screen resolution and dpi. Actually I want an emulator to edit "layout-large-xhdpi" layouts but I get a "layout-normal-xhdpi" using 1280x800 with 320dpi in the AVD Manager. I simply want to change xlarge to large. Is there a way?
Edit2 Okay,found a workaround by temporarily removing the layout for normal sized xdhpi devices(Galaxy Nexus) and editing the Galaxy Note Layout as if it were some kind of "xhdpi" layout. But still it is strange to me, that it is impossible to edit directly a specific folder file like "layout-large-xhdpi". Found only in the Layout-Editor the possibility to add a screen size but unfortunately it won't make my layout.
Nevertheless I will have to make my layouts more flexible to have less problems ;-)
Thanks anyway
You can simply do that by opening your AVD Manager from Eclipse and when you are creating the emulator just check the Resolution radio button and input your desired screen size. Don't forget to change the density of the screen too. If you just want to emulate a Tablet you can simply make an emulator with Android API 2.3 or higher and it should have the desired dimensions..
#le chiffre : may I know why you want to increase the screen, as from my experience, if you use Eclipse then I think you can't increase the screen resolution of Emulator (if I'm wrong correct me please). The size of the emulator in landscape mode: width:800 and height:400 and I get this by this code
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
and if you want to scale your application, pictures,etc., you need to get the device width and height, so you don't need to worry about screen resolution. But I don't think emulator size can be increased.
Thx and hope this helps!
In Eclipse when you start the avd, you can set the option scale display to real size and set the display size and dpi.
Window -> Android sdk and avd Manager -> start -> you will get option here

Categories

Resources