How to make images look good on both nexus and nexus 10? - android

I'm trying to make my app workable and visually better across all different screen sizes, but I have run into some issues. I have a simple image layout :
The images are sized 200 x 200 for small and 400 x 400 for the large. In the drawable folders I have made some smaller ones for smaller screens 100x100 , 200x200 and then 50x50 , 100x100. However looking at the list of devices in eclipse, the galaxy nexus 10 and the galaxy nexus both take their images from the xdpi folder. If I make the images work for the nexus its makes the nexus 10 really small and if I make them for the nexus 10 it messes up the layout for other devices. Why doesn't the nexus 10 just use the xxhdpi folder ?
How can I get around this issue ? I want to avoid separate layouts if possible as I've not attempted that yet as i'm still new to android programming.
How can solve this issue ?
Go easy on me as im still quite new. Thanks
edit
Listed as galaxy nexus in eclipse (720 x 1280)
and Nexus 10 (2560 x 1600)
as you can see major difference in sizes but use the same xdpi folder

You can declare drawables for different screen widths
drawable-sw720dp/

If you take a look at the android documentation.
It suggests that you create different layouts to support the different sizes.
If this become to much work you can restrict which sizes you support in the manifest.
So as i said in the comment above, I would create two folders, one for 720x1280 and one for 2560x1600.
I would then add a layout to each of the ldpi (low), mdpi (medium), hdpi (high), and xhdpi (extra high) if you want to try and support as many as possible.
Sorry I don't know any shortcuts. If i find anything else I'll add to this answer.

Related

how to manage ui in nexus 4 and 6

I am a developer and I am recently facing a issue that the client want the images and buttons in exact same place in all the android devices such as: Motorola, nexus 4, nexus 6, nexus 5. When i develop the user interface it changes its position as the device changes. I have 70 user interface screens , I cannot create multiple screens, and Dimensions layout also. I tried with weight and relative layout, constraint layout but the problem is same.
Edit: Images of how it looks on a Nexus 6 emulator and Nexus 4 emulator
http://imgur.com/a/96WaV
So There are two ways to make your app compatible with all devices.
Option one
You have to create all images(slices) used in your app with compatible of all dimens(mdpi,hdpi, xhdpi, xxhdpi and xxxhdpi).
to check out resolutions and size of all devices, you can go here for reference Device List.
Option two
You have to create only xxhdpi images and manage it with dimens of mdpi,hdpi, xhdpi, xxhdpi and xxxhdpi (it is not proper way but can help you).
There is good library for all dimens that you can use. All Dimens Lib

Android app layout folder name for Samsung Galaxy S Duos S7562

I need to create a layout folder for Samsung Galaxy S Duos S7562 phone which display size is 480 x 800 pixels, 4.0 inches (~233 ppi pixel density)
I found the following tutorial for helping layout creation
http://developer.android.com/guide/practices/screens_support.html
Strange thing is there is not any sample for ~233 ppi pixel density
Please advise.
Nexus S is a 4.0 inches 480x800 device and it's a normal screen size device with a hdpi density. So I guess your device has the same setting, but if you would like to know exactly these two values, you can get them programmatically with a sample app as explained here:
How to detect the android screen size programmatically ( the 4 standard sizes)?
Detecting screen density programmatically, pre-Honeycomb
Anyway, since your device should have the most common size, you can start developing your application putting the layout in the "standard" layout folder: please do not provide a layout file for any possible screen size. The link you have posted is anyway a good starting point to read in order to understand how to manage layouts on Android for different devices.
Of course, if you need to, you could think about having a different layout for the landscape orientation (layout-land folder) or for large or greater devices, like Nexus 7 o Nexus 10, using folder layout-sw600dp. The smallest-width qualifier (sw) is available only on Android 3.2 and above.
This is my suggestion and if you have a more specific issue with a layout please come here and someone will help you.

Designing layouts for phones and tablets

Okay i am familiar with this site and what it says
http://developer.android.com/guide/practices/screens_support.html
But im still having a problem.
I am designing layouts for phones and tablets from gingerbread to jelly bean.
I had started with a basic layout folder and designed everything for a galaxy nexus phone. now im going back and adding tablets. one question here is should i use layout-xlarge/layout-large or layout-sw600dp/layout-sw720dp? im guessing the smallest width is what i should be using.
But thats not the issue.
This issue is im trying to do that layous for Galaxy Nexus (720x1280) and Nexus S (480x800) These are much different yet eclipse doesn't seem to let me differentiate.
So i just want to be clear on what i should be doing to do this right. is this what i should have to cover the devices i want to?
layout-hdpi
layout-xhdpi
layout-sw600dp (instead of layout-large)
layout-sw720dp (instead of layout-xlarge)
will doing those layout-hdpi and layout-xhdpi separate the layouts for a Nexus S and Galaxy Nexus?
First, the layout-sw are based on dp, Density-independent pixels, rather than pixels. You can think of dp as 'actual size' pixels i.e., 1dp is the same physical size no matter what device is being used.
Therefore the Galaxy Nexus, which has a 720x1280 pixel screen is only 360x640 dp resolution and there is no overlap between a phone and the higher sw600+ folders.
The large/xlarge buckets will continue to work on all tablets, but if you need finer grained support or alright only using tablet layouts on Android 3.2+ devices, then you only need the sw--dp folders. You can also use both without copy/pasting your XML by using a reference file, as detailed in the below blog post.
More details on how to support multiple screens can be found in Supporting Multiple Screens guide and some of the reasoning behind why you'd want to use the new sw---dp buckets can be found on the Android Developers blog post announcing the feature.
Just use layout-large and layout-xlarge. When you're developing the layouts and want to know what it looks like on a certain device, just change the view and it will pull the appropriate XML from the correct folder.

Bad dpi on Nexus 7

I have incorrect UI on Nexus 7.
I have 10" tablet with mdpi, and my UI is OK. But on 7" nexus 7 all images and texts look very big.
I coped images from mdpi to tvdpi. and now, it is OK for me.
But, is it correct to have 2 folders with the same images? How to resolve these problems?
Read this properly. You will require different images for different pixel densities.
http://developer.android.com/guide/practices/screens_support.html
But, is it correct to have 2 folders with the same images?
You could do that but images won't look sharp because you are using MDPI images for XHDPI devices. You should understand after reading the guide.

how can i develop application for all android devices ? what setting can i put on simulator that work on most devices?

What simulator resolution i should keep when developing application for Samsung galaxy s2 and galaxy s3 ?
What i found that samsung galaxy s2 has 480x800 resolution and s3 has 1280x720 resolution so what i have understood up till now that I should ask my graphics designer to provide me hdpi graphics that contain 480x800 background images and to implement same background image in galaxy s3 mobile, I will use image of size 1280x720 and put in xhdpi folder so that it can work on s3.
The background image is something which covers whole available area for mobile app. so am i right ??
You will need to create several emulators or get various devices.
There are some pretty important ones, so generally you need to make sure you have:
ldpi, mdpi, hdpi, xhdpi
and
small, medium, large, xlarge
Some people choose to exclude certain sizes (like small and ldpi) but htat's up to you,
if you go with some or all of the following, it should be a good start:
480x320 (SE Mini 10), 480x800 (GS2, Desire, etc), 1280x720 (GS3, Galaxy Nexus etc), 1280x800 (Note, Xoom, various other tablets)
HTC ChaCha (because it's landscape default)
You need to make sure you create resources in the relevant folders for each density, usually, I tend to ignore ldpi and just put resources in:
mdpi,hdpi and xhdpi (mdpi will be scaled down for ldpi devices,
automatically)
You may also need to create various portrait and landscape layouts in different sizes.
Reading this page provides most of the necessary information:
http://developer.android.com/guide/practices/screens_support.html
This page also contains important information regarding size distribution and popularity that is constantly up to date:
Android Stats
One thing that Android does for you is that it manages resolution. If you use the proper size formats (dp, sp, etc), your layout will scale to almost all resolutions. If you place images in the proper drawable folders (hdpi, ldpi, mdpi, etc), the OS will also swap those out as necessary.
Also, the emulator should handle resolutions for specific devices, if I recall correctly.
Desing lazout in smart way! Usualy it means don't put to mutch content in one layout.
Make sure that evrything looks good on smallest size and bigest size. It is better to treat tablets separetly. Read how providing alternative resources works, you can build sepereate layouts for each screen size.
Check if the hardware is available on that device before using it. hasSystemFeature() can be used for checking.

Categories

Resources