How to create Liquid Layout in android - android-layout

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

Related

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

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.

xml layout in android that supports different screen sizes

how should we set the xml layout in android that supports different screen sizes.
I tried using wrap content and match parent but its not working properly. Please guide me for this.
Thanks in advance.
The comment about, Supporting Multiple Screens is defiantly a good starting place! By default your xml does support different screen sizes.
Although the system performs scaling and resizing to make your application work on different screens, you should make the effort to optimize your application for different screen sizes and densities. In doing so, you maximize the user experience for all devices and your users believe that your application was actually designed for their devices—rather than simply stretched to fit the screen on their devices.
However, like it says you need to optimize it. This refers to images or a completely different xml per screen size/orientation. Does this help any?
If you need something a little more specific to your situation you'll need to provide more information.

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

GWT-GXT Containers and Layouts Overview

Anybody know of a good description of containers/layouts/panels/etc for GXT? All the tutorials I've seen usually pick one or two and just use them. Nobody seems to explain the who/what/when/where/how of using various combinations.
Thanx,
~r
PS
Actually I have a slightly complex app (~150 java classes; 8 separate tabs with lots of grids, and lists and tons of RPC calls). Seems my grids are not displaying a horizontal scroll-bar and I suspect it's because I'm using some container/layout combination that prevents it (not FitLayout ;-)
Best source to know about the container, layouts is GXT samples. They are available if you download GXT. You can also checkout the examples in the GXT site. Here is the link

Colour blindness simulator

Like any responsible developer, I'd like to make sure that the sites I produce are accessible to the widest possible audience, and that includes the significant fraction of the population with some form of colour blindness.
There are many websites which offer to filter a URL you feed it, either by rendering a picture or by filtering all content. However, both approaches seem to fail when rendering even moderately complex layouts, so I'd be interested in finding a client-side approach.
The ideal solution would be a system filter over the whole screen that can be used to test any program. The next best thing would be a browser plugin.
I came across Color Oracle and thought it might help. Here is the short description:
Color Oracle is a colorblindness simulator for Windows, Mac and Linux. It takes the guesswork out of designing for color blindness by showing you in real time what people with common color vision impairments will see.
Color Oracle is great, but another option is KMag, which is part of KDE in Linux. It's ostensibly a screen magnifier, but can simulate protanopia, deuteranopia, tritanopia and achromatopsia.
It differs from Color Oracle by requiring an additional window in which to display the re-coloured image, but an advantage is that one can modify the underlying image at the same time as previewing the simulation.
Here is a screenshot showing the original figure on the left, and the KMag window on the right, simulating protanopia.
Here's a link to a website that simulates various kinds of color blindness:
http://www.vischeck.com/
They let you check URL's and Screenshots with three kinds of different color blindness types (URL checking is a bit dated though. Image-check works better).
I'd encourage everyone to check their applications btw. Seeing your own app with others eyes may be an eye opener (pun intended).
I know this is a quite old question, but I've recently found an interesting solution to transparently simulate color blindness.
When working with Linux, you can simulate color blindness using the Color Filter plugin for Compiz. It comes with profiles for deuteranopia and protonopia und changes the colors of the whole screen in real-time.
It's very nice because it works transparently in all applications (even within Youtube-Videos), but it will only work where Compiz is available, e.g. only under Linux.
Here's an article that has some guidelines for optimizing UI for color blind users:
Particletree » Be Kind to the Color Blind
It contains a link to another article with the kind of tools you were asking for:
10 colour contrast checking tools to improve the accessibility of your design | 456 Berea Street
A great paper that explains a conversion that preserves color differences is:
Detail Preserving Reproduction of color images for Monochromats and Dichromats.(PDF)
I haven't implemented the filter, but I plan to when I have some more free time.
I found Colour Simulations easy to use on Windows 10. This software can apply a color-blind filter to a part of the screen or the whole screen. And what's great is it allows me to interact with my PC normally as if it doesn't exist in fullscreen mode. It runs quite slow in my 4K screen using an integrated graphics card, though.

Resources