I am into layout design for my app to address multiple screen sizes. I referred the following documentations:
Supporting Different Densities
Supporting Different Screen Sizes
Icon Design Guidelines and
Draw 9-patch
The more I read those documents, the more I became confused and convoluted. Although this might have been discussed here, I think I, at this point, need an expert advice.
What I found is that:
make one set of 9-patch images.
make adaptable layout and let Android stretch the 9-patch image for me.
Is my understanding correct?
Well, it's not that easy if you want to support most of the devices available; just one set of 9-patch images will not be enough, unless you use them only for background patterns.
You'll need at least one set of 9-patch images for each density folder, and together with a well-thought layout(maybe different for large and xlarge devices), and a good use of Fragments, you can manage to develop a nice looking app on most devices :)
Yes, that's correct. Adaptable layouts and 9-patch for backgrounds and simple images.
Note that if you have complex images maybe 9 patch are not well suited for it. Convert it to xhdpi, hdpi, mdpi and ldpi densities, and you're set.
Good look :)
Related
I know that similar questions were asked before but none of the answers satisfied me.
I want to put minimum effort in creating icons for different screen densities for my app. How can I achieve that?
Can I just create icon for the maximum screen density I want to support and downscale that image (following the scale ratios mentioned in Android-Iconography guide)? Is this that easy? Does this solution carry any implications?
Or maybe correct approach is to create vector graphics and then generate proper icons?
Is there any better approach?
If you want to be pixerl-perfect you'll have to create a vector image first. Then generate a raster image for each of the densities that you are planning to support. After that you'll have to tweak each of the raster images by hand (to avoid things like disappearances of small details in the images for lower densities).
I am very new to Android apps and though this isn't a lot to do with programming, I could use a little guidance. I understand there are a gazillion screensizes for Android and you could make thousands of bitmaps for just one app.
To understand better, I researched a lot of pages, but these stood out the most:
http://developer.android.com/guide/practices/screens_support.html
http://coding.smashingmagazine.com/2011/06/30/designing-for-android/
I am not a developer and don't have a hand in that part (which I feel could really be beneficial to me right now). My only task is to extract PNGs from PSDs so they fit the different general screen sizes: small, normal, large, and xl whith each size supporting the different DPI.
My question is...what's the best and most efficient way to do this besides coding? I've been looking at Table 3 on the Android screen support page and I'm just a bit confused. There are blank spots in the table, for example, on the Large screen row. When you make a large screen with hdpi do you keep the screen size the same as the mdpi (480x800) and just increase your dpi? The same question applies to the other blank spots on the table.
Also, can you consider PPI to be the same as DPI? So if I set a PSD to the same resolution as a small screen with ldpi and change the PNGs to 120ppi, is that correct? I've been reading a lot on it and there seems to be no definite answer or way to do this.
As you can see I am all over the place.......
You can play with different
<ImageView
android:scaleType="..."
options to fit different screen sizes best. Also you can try to use 9-patch images.
For creating small pictures like any kind of icons you can use Android Asset Studio (just add Android Icon Set as resource in Eclipse) - it will generate icons for different screen densities for you.
I have around 10 activities in an app and around more than hundred images. Now need to provide support for multiple screens of diff sizes and densities. If I need to create for small,large and xlarge sizes even though it will be customization of 30 more activities rest aside diff densities for a specific size :O Is there any way I can stretch the whole layout depending on the size and densities, I mean what is the best way to solve this problem. It must be a very common problem but I am missing something here. I read the android dev. screen support doc but still confused. Any ideas? Thanks for your help.
It's hard to give an answer specific to your project, but in general Android does a good job of this all by itself. All layouts will automatically scale if you haven't specified fixed dimensions (ie using px instead of dp). When it comes to fullscreen images (background and the like) it is best if you provide several resolutions (in the drawable-mdpi, drawable-hdpi etc) folders. You may also have to look at the scaleType for an ImageViews you may have.
Read through the official documentation on how to support multiple screen resolutions. It provides all the information you need and it goes into detail on how to provide different layouts not only for different screen resolutions, but also for different screen orientations and things like smallest width etc (for tablet specific layouts)
Very much a newbie question here but I cannot find a clear answer on the net or in the books I have. I am designing an app to be compatible with all sizes of android devices and I want to display a images in my app. I understand that android automatically scales images to suit the resolution of the screen being displayed.
My question is what do I look for in the images I use? E.g. I have a picture that's 2418 x 2192 # 240dpi. As far as I can tell, this should be perfect for a larger screen such as a tablet. If I put this into the xhdpi image folder in my project will it be detected by other devices and scaled to suit their dimensions/resolutions? Do I have to create 3 different versions of this image in photoshop and put it into the relevant dpi folders?
I can't find a nice beginners tutorial for this stuff so haven't a clue what I'm doing!
This is the best place to start for multiple screen size support:
http://developer.android.com/guide/practices/screens_support.html
The short answer is, yes, you place the images in the different directories based on resolution and Android will select which image to use based on the device's properties. You should make a smaller set of images, for example, for mdpi and hdpi. You don't "have to" do that, and if you just place the image into drawable it can be scaled down, but that's generally not the best way to go.
This is something you'll deal with on just about all project, because there simply are so many Android devices. This resource has helped me greatly.
If you have a resource in only ONE folder, Android will scale it for you. The different drawable folders are intended to allow the developer to provide properly scaled images with minimal effort. For example, you'll want to provide an xhdpi in addition to the "standard" mdpi image to make assets look better on high-resolution devices. The app would work fine (and have scaled images) in all resolutions, even if you provided only a single image. However, if you provided a xhdpi drawable, then there's a bit of overhead to scale all of those down, and especially for icons, the results may not look very good (or even be recognizable).
I generally provide assets for mdpi and xhdpi, but if the app will see frequent use on low-res devices, I provide the ldpi as well. If possible, I include all four.
Note: The image you mention is much too large to be included in the UI resources and would probably best be placed in assets and loaded on request. Even on xhdpi devices, it would have to be scaled down.
I've been through this post (and others) as well as through the documentation about supporting different screen resolutions in Android, but I couldn't find a clear answer to a (simple) question:
Is it ok to just use "res/drawable" for images in an android app?
Background: The only images that are needed in this specific app are the app icon itself and an icon for a notification, there won't be any images in any layout.So in my understanding, if no "hdpi"-, "mdpi"- and "ldpi"-folders are found, Android will use "res/drawable" as the fallback.As the only pitfall with different screen-resolution seems to be that Android will scale images for a specific resolution if no special one is found, this should only be a problem when UPscaling, because the image will get blurry. But if I provide all "hdpi"-images in "res/drawable" (instead of 3 different ones), won't Android just DOWNscale those images if the size is too big?If that's true, I could save some APK-space by just a third of the images.
Follow-Up question: I read that for API-level 3 a dir by the name "drawable-v3" is required. Is that true or is "drawable" the fallback for this API-level also?
Any hint is appreciated.
The images in the drawables folder are assumed to be at mdpi resolution, so they will get scaled up/down if you don't provide the others.
Scaled up images will be low-resolution and look fuzzy. Scaled down images will have pixels missing and look jaggy.
So your app will "work" with only one set of default images, but will look awful on many devices. I strongly advise that you create the images in different sizes, so it looks great on all devices - it's a bit boring, but not hard to do.
It won't be long before we have xhdpi devices, so while you're at it you may want to create those too.
I assume you've read this
Not a complete answer, but: highly downscaled images can and usually do look just as bad as upscaled images (but in a different way), because graphics libraries almost exclusively use interpolation methods for resizing, and interpolation methods are limited in terms of how much they can shrink an image before serious information loss (to about 50% for linear methods and down to about 25% for bicubic methods). This is why most platforms have evolved conventions (like hdpi, mdpi etc.) that let you embed images that are best for each screen size.
I use drawable/ all the time, and then I go to BestBuy and all the local wireless stores and test my apps on small/large/huge(tablet) devices and they look just fine.
Unless you have some reason to target pre-Donut devices (now only 4% of the devices according to http://developer.android.com/resources/dashboard/platform-versions.html), then you should put your bitmaps in one of the -Xdpi directories. The generic "drawable" directory is a synonym of "drawable-mdpi" for compatibility reasons, but a modern well-written app should be putting its drawables in a directory matching the density they are designed for.
res/drawable is the fallback
the caveat is that scaling not only degrades the image but takes processing time too.
I have not even read the API-Level 3 docs yet, sorry for 1/2 an answer
For what it is worth I found the image handling of Android to be tedious and unreliable. The concept of including different size images for different screens will result in large application files bloated with images. There are already screens that don't fit in the standard resolution ranges. I have found it is best not to let android handle the scaling, it seems to create a base image for the smallest screen you target and then scale it up resulting in ordinary looking images on large screens. This happens even if you made the image specifically for the large screen.
My solution that seems to work on everything from a 2" samsung phone to a Sony Tablet is to create images at high resolution and use Bitmap.createScaledBitmap() to get the size I need.
caveat: I am new to Android and have lots to learn.