Recently i develop an app for Galaxy 10.1 ,7 inch with 1024×600 ,480×800,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-1280×800 and for S3 layouts-normal-xhdpi-1280×720 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-1280×720 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
tabletand directory name islayout-sw600dp.Now, when part came to height and width problems, I have created several different
valuesdirectory in which i placedimensionsandfont sizeand other stubs. So there will be noconstantvalue inlayoutof tablet screen.and your
valuesdirectory name will be likeAll 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.androidsite.Configuration examples
To help you target some of your designs for different types of devices, here are some numbers for typical screen widths:
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-sw720dpso instead of creatinglayout-normal-xlargeyou should use this thing which lets you to decide differences. Instead of identify differently usinglayout-large-mdpiandlayout-large-ldpi, are’t you just identify by itssmallest width? Because, android providingdrawablesdirectory for different images, only thing is its resolution. And you have above solution.