I have problem in Android app.
My layouts don't working correctly on 480*800 screens
On HD, Full HD and qHD it working correctly
For example my axml code:
http://pastebin.com/a07PB0MV
How can I make it working correctly
Both the Xamarin Android designer and Android Studio(which many use for UI design) have a dropdown for different device layouts. This should help with at least visually looking at the app on lower resolution phones.
You could also use a screen density specific layout, where a specific layout is created for the smaller phone screen sizes(like 480x800).
https://developer.android.com/guide/practices/screens_support.html
See the section on "Using new size qualifiers"
Related
I have got an enhancement of one application. It is developed for 10.1 inch tablet. However it is working nice for tabs with size 10.1’ and for other screen sizes UI is poorly aligned. I need to do the changes in application so that it will be as good as 10.1 inch app for all other screen sizes(>4 inches).
I have few doubts here on my approaches.
1) I have found “size qualifiers” in android developer’s site. How many type of layouts need to use for each screen to make good for all sizes in android world.
Note: All screens in this application are always on land scape orientation. Is size qualifiers still works here?
2) Somewhere I found in “stack overflow “, It is already developed for 10.1 inches so that use percentages and change to every screen size.
100% -> 10.1’
? -> 7’
Which one is good and proper solution for maintenance also? Is there any other best solutions?
There is no hard and fast answer.
It is up to you to determine how many screen sizes you want to optimize for.
I'd suggest optimising for small, mid and large with layout qualifiers:
1) size qualifiers do work in landscape as they assess based on smallest screen width.
layout
layout-sw600dp
layout-sw800dp
2) I dont understand your question... i've never seen percentages used in Android layouts
There are so many different screen sizes that you can adapt your layout to..
In Eclipse's graphical layout you can also choose the screen size and resolution for which you want to develop (you can define the screen sizes and resolution and you will see how the layout looks on each of them).
You can also have several images that will be chosen automatically for each screen size via the drawable folder. You got drawable-hdpi for high density screens, drawable-xhdpi for extra high density screens and so on.. you can change an image to adapt to many of the screen size using Google's Android Asset Studio : http://romannurik.github.io/AndroidAssetStudio/index.html
You should also read the Android developers guide:
http://developer.android.com/training/multiscreen/screensizes.html
http://developer.android.com/guide/practices/screens_support.html
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 have read an much more documents on android and other blogs about how to support multiple screen sizes. And To some extent I am successful in making some good looking designs for apps. Now let me start from the start what is the problem and what I wanted to ask from you guys.
Android has now different screen sizes of different screen densities and having different resolutions. so We have to face 3 different things the size , density and the resolution.
Now Let take example of Samsung s4(xxhdpi device having 1080*1920px) , Samsung Grand (hdpi 480*800px) and both has same screen size that is 5 inch
and Samsung galaxy note 10.1 (Mdpi devices ) 10 inch screen size.
Now android says to make different drawable and put them into respective folder, its ok, let suppose its done. Now what ?
lets suppose , What if I have to set the image in left top with the marginleft of 5 dp and some other views according to them with different specific paddings and margins in dps and suppose I have set all of these in my layout according to hdpi device, which we know is not going to look good in samsung s4 xxhdpi device and tablet.
and Also as design pattern says to change design for the tablets according to your need , but on the other hand the support of making different layout has been deprecated now we have to use different values folder.
so in short what is a best way and what is clear thing for making drawables.
how should we re size our drawables to support all devices , and also if making different layout has been deprecated now what should we do to make our design look good and approximately same in all devices?
also how to judge that device is tablet and we should now start showing the multi pane design ?
please do not refer me to android developer website , I know its very helping and I learnt a lot from there , but right now I just want to discuss the technical issues and want to take advantage of some experienced developers. Thanks
I have been working with programmatic layout in Android Studio and i have a problem:
AVD always uses normal layout even if i use Nexus 7 which has "large" screen as its property
it is not code problem, since when i plug in my tablet it uses large layout and works fine
Any ideas where the problem might come from?
Well you are right in some sense android should take layout dependent on different densities but some mobile do not fall under specific density. Therefore android will pick up default layout from layout directory.
to support multiple screen resolution provide different layout for different screen sizes, you can make following directories in res directory like this
layout-hdpi
layout-mdpi
layout-xhdpi
layout-xxhdpi
layout-w320dp-h408dp
layout-w480dp-h800dp
layout-w480dp-h854dp
layout-w720dp-h1280dp
layout-w1080dp-h1920dp
layout-w1440dp-h2560dp
when you provide layout in all this directories you will give multiple screen support for different sizes as well
I have created layout files for small, large and xlarge screens sizes, but when I load my app on a Samsung S3 emulator, with the resolution of 720 x 1280 it is still the default layouts which are being used.
I do not understand why android is not using my specific layout files.
I have placed the layout files in the folders layout-large, layout-small, layout-xlarge under the folder layout.
Hope someone can point me to what I am doing wrong.
Thanks.
The screen size buckets you are referring to are deprecated since Android 3.2 (API level 13?). If you are targeting later versions of Android then you should be using the "smallest width" qualifier to enable a finer grain control.
The Samsung Note for example will leverage the old "layout-large" bucket but it doesn't respond well to mini- or normal tablet layouts. These devices are normally running Android post 3.2 (the DELL Streak and original Galaxy 10.1 tab are the exception). To differentiate in this instance supply a layout-sw520-port and layout-sw520-land resource folder and place the layouts here. Further differentiations can be made for Nexus7 type devices (sw600) and so on. Note there are reserved pixels on screen (notification/action bar etc) so the physical smallest width DPI is not precisely what your layout will respond to (albeit predictable close).
Diana Hackborn (hackbod) wrote a comprehensive blog post on the subject describing the motivation s behind the change and the sorts of problems (cf. Your issue) it solves. Google have also put together some advice on designing for multiple configurations as part of their tablet drive. Have an Android Dev Guide trawl should you hit further issues.
Samsung S3 is in the "normal" category.
What I found helped me greatly to get layouts which scales to different resolutions was layout_weight="1" and layout_width="0dp", just in case someone drops by this question wondering why there layouts do not scale in some areas.