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

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.

Related

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

Making Software ready for Retina Display - Why is this necessary?

Now that the new Macbook Pro is coming out with a Retina Display, there are a lot of resources out there on how to make Mac apps and now even websites "Retina Display Friendly". Even Google is updating Chrome for Retina Display...
Why is this necessary at all? From what I understand, Retina Display is just a higher resolution screen. Right?
I thought when you develop gui's for desktop software and develop websites, you are developing something that is supposed to work and scale properly with virtually any resolution... When you resize an app's window, or display it on a higher or lower resolution display, it is supposed to scale and display properly.
So why are these people coming out with guides on how to make something look good on a Retina Display? Shouldn't it already look fine by default? Is there something about Retina Display that I'm not understanding?
And for the record, I'm not talking about iPhone 4 Retina Display. Most iOS dev's make their apps with fixed position elements since they know the screen's won't change size/shape. So I understand the importance of developing an app to look good on the iPhone 4/s vs 3g/s.
With the Retina display apps don't actually scale like they're being resized, all the controls are resized to be twice as big. If an app would be scaled normally, not by scaling all the controls, etc. you wouldn't see anything, because everything would be too small. It's the same difference between a Retina and a lower-resolution display as on the iPhone 3GS / iPhone 4.
An example:
These images are actually the same size, just the pixel densities differ.
And here's how it looks not properly scaled (using some app to disable proper scaling):
http://cloudmancer.com/images/trueretina.jpg
I thought when you develop gui's for desktop software and develop websites, you are developing something that is supposed to work and scale properly with virtually any resolution... When you resize an app's window, or display it on a higher or lower resolution display, it is supposed to scale and display properly (StackOverflow, for example, uses a 960px-wide container).
From a web developer standpoint, you are often asked to develop fixed-width websites (ranging from normally 940 to 1000 pixels wide), and they don't get to scale at all. There are a lot of websites like this and many apps just aren't designed to increase in size.
Also, apps that do grow in size usually expect that a bigger resolution also means a bigger screen, so they simply stretch the main application panels and are done with it.
Now, consider static elements, like a 150x50 button that says 'Click me'. This button is not intended to become bigger and is perfectly acceptable on a regular 1440x900 display. Now the retina screen comes in with its 2580x1800 resolution. The app sees the resolution change but it thinks "Hey, that user must have a huge screen" so it keeps the button the same size.
The problem that now occurs is that the button, because both resolutions apply to the same 13" screen, is now appearing to be a fraction of the size of the original button. Depending on your user vision, he might not be able to read the text on it, and might have a hard time clicking it, depending on the mouse settings.
To fix that problem, Apple and Microsoft used two different solutions:
Microsoft decided to tell the app the display had a 2580x1800 resolutions, but that the user wanted to have everything scaled to 200 dpi. This means that, if an app does not follow the guidelines, it will look smaller. Many apps simply ignore the DPI settings (though this might change with Windows 8);
Apple decided to report to apps that the resolution of the monitor was 1440x900, but that it could display higher-resolution elements if asked to; This means that apps existing before the new retina settings will appear to be the same size as before for the end-user (with added benefits like crisper text if they use the default Apple APIs), but that they can decide to provide high-DPI images that will look much better on the display.
Both solutions requires apps to be aware that the display is high-DPI ('retina'), but the way Apple handled it means the static websites and apps mentioned earlier will keep looking just fine, except they wont have super-crisp, high-resolution images to use. And, to opt-in to the retina features, they have to provide 200x200 images for a 100x100 canvas, for example, and Apple will take care of the rest.

Does android supports SVG or Tiny SVG?

does android supports SVG or Tiny SVG ? I am having doubt like if i want to publish my application to android market which will cover different sizes of android devices then in that case i need to create same images with different densities, sizes etc.. and need to put on the different folders as specified in android developer guides. I just want to avoid it because it will unnecessarily increase the apk file size so rather than using this approach can we create the vector graphics file and store all image related information and add it in to the apk file.
but I am not able to find whether vector graphics approach will work in android or not and if it is working then how to use it?
Please provide me some valuable information about it.
Regards,
Piks
I found TinyLine. I have not tried it, but it seems to be sophisticated.

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