i've created an application for galaxy S..so i'm using 3.7 inch(resolution 320x480) layout for my xml files. The app is working perfectly on the phone. When using the same app in HTC wildfire whose resolution is 240x320 the graphics are out of position. I know the reason is obvious that I'm developing app in 3.7WVGA so graphics will not be compatible for QVGA.
Is the only solution is to create different versions of app on the basis of devices?? or is there a universal solution which i can implement so that the app will run without graphical repositioning on all the devices having different screen sizes and different resolution support??
please help me...coz i dnt really know the answer....and thank you in advance
If you can get away with it, use linear layouts and position things by weight. That way the ratios will stay the same and the same general appearance will hold.
Related
I am about to publish my first app and I am extremely confused about making it look nice on different screens.
At first I thought mdpi/hdpi/etc. values (dimensions) folders would suffice when I saw that the screen was showing the exact same things on S4 Mini & S6 Edge, hdpi & xxxdpi respectively.
Well, how is this even possible when I haven't specified other than the main dimensions.xml file?
From what I understand from playing with the layout editor on different devices is that screen size matters more (?).
So far I have created a mdpi/hdpi/xhdpi/xxhdpi folder but it seems that that's far from enough.
What other folders should I make? Do I need many layout folders too?
I would use this scalable size unit library. It's really easy to use and it will automatically scale your widgets for various screen sizes.
Here's the link if you are interested: https://github.com/intuit/sdp
Since the launch of Nexus 5X and Nexus 6P, I have noticed my layout designed previously looks relatively small on these new two devices. I tried creating multiple Layout resource folders but nothing seems to be working efficiently. After going through multiple tutorials and blogs, I am still struggling with this issue. Any kind of help or tutorial would be really appreciated.
Using multiple layouts is the correct way to solve Layout problem only. Besides, you also need adding suitable drawable resolutions and dimensions.
See more:
Make sure to use dp and sp as your scale.
Make sure if the correct layout folder is being picked by the mobile phone (see note below)
Resolution of image assets must be proportional to the dpi - check the Android icon resolution requirements and scale your image assets accordingly.
*To determine if the app does pick the layout folder you intend the app to pick - you could change the background for different layout folders and determine which one it picks *
it's my first time to develop for Android and I almost finished the app but when I started testing it I faced some problems related to UI. I tested the app while programming it using galaxy s6 edge plus which has a 5.7" 1440x2560 screen, the app has many textviews and I used "sp" units for their text sizes and also used "dp" units for the margins between them. For some textviews I set their backgrounds as a drawable xml in which I set a value for their width and height using "dp" units instead of using wrap_content because I want the backgrounds to be larger than the text inside it so the user can easily touch it. I also made a large-layout folder where I put new xmls inside it with larger fonts so that they work will on tablet and they did, I tested the app on a tablet and it looks great using these xmls and also the app looks great on the 5.7" phone with the normal textviews. Then I tested it on 2 phones with smaller screens each of 5" one of them with Full HD resolution and the other with HD resolution and it looked good on both of them too but when I tested it on a phone with 5" screen but low resolution (480x800) the app looked terrible, textviews interfering with each other and the drawable backgrounds are too big, in short the whole UI is a mess.
What I need to know is whether I also have to test the app for more screen sizes below 5" or for other resolutions too? Because if this is the case then this means so much work!
This is a screenshot of the code for the textview with the drawable background
Thanks in advance
Go through this tutorial: http://developer.android.com/training/basics/supporting-devices/screens.html and this too: http://developer.android.com/training/multiscreen/index.html
I'm sure this will help you out.
If you still encounter any problem, feel free to ask again!
Peace.
I am designing(PSD) an Application for Android OS, which will be developed by developer. I need to provide him the mockup of Design(PSD), Which we target to run on all android devices. I have searched for resolution to design, but the answer I have seen is really large number of resolutions.
Do I need to design Application for every device separately. or Is there any standard sizes I could design, So that I work on all devices?.
Can anyone explain here with the Resolution and PPI.
Well, you could design it for many screen sizes. Note that today most devices are widescreen. So the first step should design a 16:9 layout. You have to design it vertically and horizontally way.
So, at this point you should think about two layouts at first: Horizontal and vertical. You should now start to imagine the look of the app in both alignments. Second, you should note if the app will be for tablets, for smartphones or both. So, in case you have to design for both, then now you have to think in 4 layouts: Tablet horizontal, Tablet Vertical, Smartphone Horizontal, Smartphone Vertical.
Now? Take your Photoshop and start to design. You can download many Android PSD Templates for mocking up your layouts. Which resolutions to choose? Well, I'd go for 1200x675 for Smartphones and 1920x1080 for tablets.
Note that this is for having a reference for the developer. If he needs Pixel Perfect layouts then you should talk closely with him.
ldi:mdpi:hdpi:xhdpi :: 0.75x:1x:1.5x:2x
So make each of the drawables (png) with resolution in that ratio
Right now I have an application I built that is built for android 10.1 inch screens (tablet) and I would like to to be able to be scaled so that it work on the kindle fire (7 inch screen). What would the easiest way to do this be?
Edit:
So I've taken the advise that the majority of the people in this tread have given and replaced all of the absolute layouts with relative layouts and I am using margins left,right,top,bottom, to place them, but still the button images are too large and they are misplaced, how can i do this so it works correctly?
There are some design criterias for developing android applications to make them work in different configurations like screen size:
use different layouts for different configurations
use fill_parent and wrap content properties in layouts
do not give hard coded pixel values
do not use absolute layout
provide different drawables for different configurations
for more look here: http://developer.android.com/guide/practices/screens_support.html
Following the best practices guidelines is always good but sometimes you simple need a whole new layout for different screen sizes. Android allows you to create different layouts files for different screen sizes. To do this you can create a new folder under 'res' called 'layout-large' or 'layout-large-land' for landscape. The same is also true for 'layout-xlarge' and 'layout-xlarge-land'. You can just add another xml layout file in these directories with the same names and same ids and android will automatically pick the right one based on the users screen.
http://developer.android.com/guide/practices/screens_support.html
Honestly, it depends on your application. If you built it so that it would work with tablets and you didn't specify non-percentages for your widths and heights, it will probably automatically scale to the proper size on the Kindle Fire.
Honestly, get a test device (or emulate the size using the Android Emulator) and see what happens. Very likely, if you followed proper design patterns, the app will Just Work (TM) on the Kindle Fire.
If it doesn't, you might want to take a look at how you're specifying the sizes of your elements. Using Pixels or any other type of pixel-based numeric measurement will do some strange things to your UI. Instead of widths and heights, use paddings and margins defined with density independent pixels. This will help your app scale properly.
I recently wrote an app testing it only on mobile phones, and was pleasantly surprised when I purchased a tablet, and the app scaled up perfectly - with no warning from Android about different ways to scale it.
Realy easy, but not recommend because it can pixialize images, is Enabling Screen Compatibility Mode.
Try adding this:
<supports-screens android:compatibleWidthLimitDp="320" />
OR this:
<supports-screens android:largestWidthLimitDp="320" />
to your AndroidManifest.xml.
To understand whats happening check here:
http://developer.android.com/guide/practices/screen-compat-mode.html#Enable