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
Related
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
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.
I have my view built to fit a phone screen 800x480. The background PNG shows up as a perfect fit. I have a bunch of imageViews of PNGs sitting on the view that should line up perfectly on any screen that is that size.
When tested on my phone, it works fine. However, when tested on my 7" tablet that has the same screen resolution, the backdrop fits as expected, but the imageViews are all too small.
Why wouldn't they fit the same way, considering the resolution is the same?
Could it be the aspect ratio of the second screen?
I know that when I developed an app on my Note I, it showed up differently on almost every other device with the same resolution, on account of the aspect ratio of the Note I being so wide.
Can you check and see the actual pixel ratio of your second device?
Also, is it showing the on screen action bar thing? The back/menu/etc bit? Because that could be because of the version you're targeting is less than the version of your 7" device, causing it to run in backwards compatibility mode. That'll squish your layout a bit as well.
I have a partial answer to this.
I couldn't find a way to set the size of the PNG itself. Only the ImageView height and width. So I set those to 90dp. I tried px first. Don't do that. It's no good.
But, check this out... Forcing the size in dp made the images show correctly on the tablet, but enormous on the phone! So, it more or less reversed my problem.
But at least I know what the problem is now. I just have to create a secondary view for 7" screens to set the imageView sizes. Or, I'm thinking there must be a way to do this problematically. Before the view launches, detect the screen size, if it's not a phone, change the height and width accordingly.
That should work because, as I mentioned in an earlier comment, the relative positioning is perfect. It's just the size that's incorrect.
I've 2 tablets:
1 Samsung Android 3.0
DisplayMetrics {density=1.0, width=600, height=976,
scaledDensity=1.0, xdpi=161.55031, ydpi=155.51021}
1 Low cost device, Android 2.3.3
DisplayMetrics {density=1.0, width=480, height=800,
scaledDensity=1.0, xdpi=160, ydpi=160.42105}
If I use different layout for each screen size, both devices says they are large-long and mdpi, so I can't distinguish them by using layout folder names... The problem is:
I use a TextView with textSize="20dp"
In the firse device, text width is half of the screen, in the second device is bigger (80% of the screen width). Why? I expect that both devices display text in the same way if I use dp (and not px). I tried also with sp but nothing changes...
(I used TextView as example, I've the same problem with all elements in the layout: button sizes, ...)
I would try to use layout folder names like "layout-w600dp" or something else introduced in Android 3.2 but this is not the case.
I know I can change element dimensions by code in onLayout() but I don't want to do that...
Any suggestion?
Update
I solved my problems with layouts using themes: Activate a specific dimens.xml at runtime
The android documentation on Dimention say this
The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion
So it's totally ok what you see
You can achieve 50% of the screen using LinearLayout weigth..Refer this
I am doing some Android programming tutorials, but when the emulator opens up it takes up most of the screen, which is much bigger than a normal phone looks like.
Here is a picture of my screen: http://i.imgur.com/gEuHs.jpg
And it doesn't let me resize the emulator. Are all emulators this big, and is there any way to make it smaller or resize it?
You can use a smaller resolution.
Alternatively, if you want to keep the same resolution, you can change the property "Abstracted LCD density" and check "Scale display to real size" when you start the emulator. Increasing the density will make the emulator window proportionally smaller.
You can try getting a bigger desktop, or adjust scale of window when it starts. Also, i don't recommend changing the dpi because it blurs the icons (framework-res.apk has only mdpi and hdpi drawables i think).