Which layout qualifier should be used with Android 3.0 or above? - android-layout

I was using layout normal, large, x-large but it was not working. I found out that Android works on the smallest dp. So I searched and found these two methods for layouts qualifier.
First method is to use layout-mdpi, layout-hdpi, layout-xhdpi, layout-xxhdpi. Second method is to use layout-sw320dp, layout-sw480dp, layout-sw600dp, layout-sw720dp.
Now I am confused about which method is the standard way to use layout-qualifiers? I have searched around Google Docs Screen Density
I am not able to get final decision what to use for layout from the above-mentioned methods

Which layout qualifier (for different screen sizes) you should use does not depend on which Android Studio version you're using. It depends on what you need.
In your case, if you want to support devices (for different screen sizes) which run on API level 12 or lower, you have to use the legacy size qualifiers (e.g. x-large). If you want to run it on devices using APIs above level 12, you can use the smallest and/or available width qualifier (e.g. w-600dp and sw-600dp respectively). Read more here. All the qualifiers in this paragraph are standardized; it just depends on what you need.
The qualifiers mdpi, hdpi, and so on are not used as qualifiers for different screen sizes layout, but for resources (in particular, images). This is so that Android can auto-generate versions of your rasterized images to display good graphical qualities for screens with different pixel densities.

Related

How to correctly layout wxWidgets/wxGTK items taking their size into account?

Everything inside my application is laid out using sizers with hard-coded border sizes. This makes it fit very nicely inside Windows with wxWidgets:
But when I started porting it to Linux with wxGTK, since GTK+3 elements can vary a lot in size, everything ends up being misaligned:
Is there a way to responsively layout items taking into account that controls can be in different sizes, and the discrepancies between points and pixels as units of measurement?
You can't hard code any sizes to have a fighting chance of a layout working well on different platforms with different font sizes, DPI settings etc. If you're defining your layout in C++, use wxSizerFlags::Border(), DoubleBorder() etc methods. Also, align controls relatively to each other, e.g. using Center() for all the controls that should be in the same row (or use wxFlexGridSizer).

How to apply layout constraints to in windows phone 8.1?

How can I apply layout constraints to layout so that it auto adjusts it self for every device like we apply in iOS?
The app I developed leaves blank spaces when I run it on higher size devices.
There are several techniques you can use. Which is best depends on your app's specific design:
Use a fluid control such as GridView or ListView which will expand to fill the available space.
Use a relative size layout control such as a Grid to lay things out by percentages.
Use Visual States to choose different controls or layouts for different size or aspect ratio screens
Use a ViewBox to stretch a layout to fit
Windows 10 adds a few new controls that can help:
RelativePanel to specify control locations relative to other controls (on top off, to the left of, etc.)
Adaptive triggers to automatically switch Visual States based on window size changes
See Defining layouts and views on MSDN for details and quickstarts.
There were several sessions at Build 2015 which touched on this subject, although more aimed at Windows 10 capabilities than at Windows Phone 8.1

What is the purpose of /drawable-v14 or /drawable-v11?

I've seen that some Google's or other open source projects have resource directories like /drawable-v14 or /drawable-hdpi-v11.
Now, I understand what this means: all devices with SDK larger or equal than v11/v14 should use these images.
But what is the purpose of this? Why and when should I use them? Why devices of HDPI resolution and SDK v11 should ever use images different than HDPI devices and SDK 10?
I just cannot see when I will ever use one image for SDK 10 and another for SDK 17, for example. Makes no sense to me.
As a side note, the usage of resources /values-v{11/14/17} is logical and has the practical benefit.
This can be use in order to style your icons to the current UI guidelines on the given Android version.
Android has had a lot of evolution on its GUI style from its beginning. In Cupcake, icons had to show a 3D effect with a shadow. With ICS, there is more flat icons. And it will keep on changing with android 5 and more... (Let's watch the Google i/o 2014 to know more about it! ... by the way: its today!)
So basically you can stick to the GUI guidelines even from different Android versions. It's probably not the only use case but it is one of them.

How To create Responsive Layout

I am new to android and i dont know how to make responsive layout which can be
display equal in all devices,please help me out by providing some code for that.
All android resources are correctly scaled for whatever device you put them on.
However, you may want completely different or just slight different layouts (even though the scaling is handled perfectly) for the purpose of functionality.
For this, you'll need to use the android resource systems constraints and most likely fragments.
Fragments are covered in the following link
http://developer.android.com/guide/components/fragments.html

How to create Liquid Layout in android

I am into a project in university, I would like to know that how can I use liquid layout in android so that different screen sizes must see the application according to its resolution?
In simple words, I would like to create an application whose layout is perfect in all the type of screens :)
I know how to create it in simple html/css in websites for PCs, but how to do it in android?
Can anyone please give suggestions/help/tutorial link?
Thanks,
Usman
Android provides "liquid" layouts out of the box - the layout dimensions and contained elements adapt to screen resolution automatically. It is gracefully handled by the Android framework. There are various kind of layouts available (LinearLayout, FrameLayout etc.) so you need to check carefully which type of layout is the best for you.
You should avoid AbsoluteLayout. While it is true it lets you specify exact locations (x/y coordinates) of its children it is less flexible and harder to maintain than other types of layouts without absolute positioning. It is now deprecated anyway.
Useful links:
To read more about different layouts see: http://developer.android.com/guide/topics/ui/layout-objects.html
Good tutorials are also available here: http://developer.android.com/resources/tutorials/views/index.html in the "Layouts" section.
AbsoluteLayout doc: http://developer.android.com/reference/android/widget/AbsoluteLayout.html
Update:
Layout itself will adapt to different kind of resolutions automatically but you need to keep it mind that elements contained in a layout can look differently. The same image will be smaller on high-res screen than on low-res screen. Luckily, Android provides a way to deal with this problem in a simple manner. You can supply different images depending on the resolution that a device has (this is a bit of a simplification because there are other factors eg. pixel density in addition to resolution that matters). By the same token, it is also possible to supply a different layout but it is not that common.
Links:
Full story on multiple screen support: http://developer.android.com/guide/practices/screens_support.html
Sample code: http://developer.android.com/resources/samples/MultiResolution/index.html

Resources