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
Related
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.
I have a requirement in android to support my app in different tablets like google nexus 10 and samsung galxy 10 inch tablet. Nexus 10 is double the resolution of samsung 10 inch tab. I need to place different images for nexus 10 to make my app looks with better clarity for nexus 10 . But both the devices are taking the image from the drawable-xlarge. How can I differentiate between these two devices in drawable level and layout level. Same case is applicable for phones as well where I need to differentiate Samsung galaxy s4 which is double the resolution of xhdpi phones.
-xlarge is a screen size qualifier. Your drawable folders should use screen density qualifiers (-mdpi, -hdpi, -xhdpi, -xxhdpi). If you must, you can use both, e.g -xlarge-hdpi
Don't forget the new smallest width qualifiers. They are of a great help when you need to differentiate based on screen resolution.
I wouldn't consider a non-Nexus tablet anymore, based on how bad manufacturers have been at bothering to update them. The Nexus devices being "Official Google" devices and getting updates from Google means that they're going to be updated for a long while going forward, and once that ends, you can still unlock and root them through a defined process & update things yourself if you care to do so.
I can't think of any 10" Android tablet I'd have other than the Nexus 10. They're really that good.
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.
Recently i develop an app for Galaxy 10.1 ,7 inch with 1024x600 ,480x800,Note with 800 height abd S3 with 720 height. they are all running perfectly on these resolution. But when we talk about note 2 and galaxy 7 plus and other we got several issues .Which are that the layouts are not correctly seen on these devices. At that iam facing a problem in layouts i use layouts folder for note as layouts-normal-xhdpi-1280x800 and for S3 layouts-normal-xhdpi-1280x720 and put all the layouts in one folder which makes one apk supporting all these layouts.
But when customers download the apk they deal with a problem which was that the Galaxy note picking the layout-normal-xhpi-1280x720 layouts and it was right but S3 and Galaxy Note 2 have different density .
Because of that problem I can't figure out how to declare layout folder for S3 and Note 2.
Is there any way that i use only default four folders
Layout Xlarge
Layout Xhdpi with normal
Layout mdpi
Layout hdpi with normal
and supports these all layouts for all screen like S3 ,note 1, note 2, 7 inch plus and others. When i try to start my project i always thought about the big famous games like one of these is "Temple Run" which runs on all mobiles and tabs.
Making bunch of layouts folder make my app heavy like it crosses 80MB limit and Google market only accepts less than 50MB apps.
Pro grammatically is there any way that we use only one layout folder and support this layout on all screens.
I read number of articles and android developer portal but they did not satisfy me.They all said you have to make different layouts folder for different screens and even on stackoverflow i saw the same situation for saving my time in first projects
I use these techniques but my work is now increasing day by day and i want that i start with those techniques which make my app not heavy because of these bunch of layouts plus not waste my time in making number of layouts for numbers of app.
Number of helps will be appreciated and i want answers and suggestions because these problems are faced by number of developers which are new and others also.
I am also facing such problem in my application. But i found a good solution for this.
I have only one layout for tablet and directory name is layout-sw600dp.
Now, when part came to height and width problems, I have created several different values directory in which i place dimensions and font size and other stubs. So there will be no constant value in layout of tablet screen.
androd:layout_width:"60dp" // i drop this scenario
androd:layout_width:"#dimen/tab_width" // i used this scenario
and your values directory name will be like
values-xlarge
values-large
All the values will be fetched from your values directory. It will not create different layout, but one layout can be used multiple times.
Edit:
Following are words of Developer.android site.
Configuration examples
To help you target some of your designs for different types of devices, here are some numbers for typical screen widths:
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
Using the size qualifiers from table 2, your application can switch between your different layout resources for handsets and tablets using any number you want for width and/or height. For example, if 600dp is the smallest available width supported by your tablet layout, you can provide these two sets of layouts:
res/layout/main_activity.xml # For handsets
res/layout-sw600dp/main_activity.xml # For tablets
===
In this, you can see that, layout for 1280*720 is under layout-sw720dp so instead of creating layout-normal-xlarge you should use this thing which lets you to decide differences. Instead of identify differently using layout-large-mdpi and layout-large-ldpi, are't you just identify by its smallest width? Because, android providing drawables directory for different images, only thing is its resolution. And you have above solution.
I am developing android app which has lots of images. It's a korean app.
I want to support maximum number of resolution possible.
So I created 4 different folder(ldpi, mdpi, hdpi, xhdpi) for drawable as the google doc stated.
Now my problem is that my app work on all most all device perfectly but In korea there is device Pantech Vega LTE M which is giving lots of trouble
It's resolution is of xhdpi category but still in this device my app shows images from mdpi and it show bigger than it resolution. So half of the image is displays compressed.
So I am not getting how to set the drawables for this device. Do i need to add separate drawable folder to match this resolution.
If i changes the images in mdpi folder than it will create problem for other resolution.
Beside how many folder I need to add make my app compatible with every possible resolution available.
Thats because that device runs Android 2.3 Gingerbread where the X-Large configuration was yet not supported since that resolution was supported beginning with Adroid 3.0 afaik.
Edit:
Looks like the xhdpi was supported since API level 9, and the configuration specs from your device looks like a normal - large screen with xhdpi. So the only workaround that I could think of is creating those folders within your drawables.