I have been battling with this for a couple of days. I am trying to write a small custom rating bar. With some custom images. When I check the image I have on my HTC Desire, the image looks horribly aliased. I have tried using different resolutions and different sizes and still can't figure out what resolution/how to create a good quality.
I have read the guidelines on the android site but, to no avail. I think the problem I am having is displaying lower resolution images on a higher dpi display. So the system upscales the image. But I am not sure how to fix that. Higher resolution images? Larger images?
Any advice would be great.
Alex
The reason why this is a bit of a challenge to get right is the wide variety of screen-resolutions and -densities of Android devices. Fortunately the Android SDK has pretty extensive support in this department. A very good start is this section of the Android Dev Guide.
Basically you need to understand the concept of Density-independent pixels (dp) and use classes like DisplayMetrics to calculate actual screen pixels. And yes, obviously you'll need larger, higher resolution images for higher density screens.
Related
I am trying to design an android app and feel stumped on the dimensions of the logo to be placed on the various DPI screen versions and other scenarios possible. Please suggest what should be the size of logo per DPI screen. I am using attached image as reference for other design specifications such as icons and bar size.
I am trying to create a launcher icon
Developer has requested different logo size versions as per the
screen DPI.
What should be the size of the correct size of the logo max and min
to be placed on any screen of the app? Is it completely up to the designer?
Thanks in advance.
There are commonly two ways to target all screen DPIs.
Easiest way - Make all images to Extra High or Extra Extra High DPI.
Safe way - Make all images for every single DPI.
Now my question is what size should my logo be in order to be able to make Make all images for every single DPI.
Hope this help to understand.
If you are trying to create a launcher icon then the sizes in pixels are clearly defined in the image you have posted.
To get started you should try loading the logo into the Android Asset Studio at:
http://romannurik.github.io/AndroidAssetStudio/icons-launcher.html
This may give you good enough results to use. Otherwise, you can at least see what icon sizes are required and what folder layout is required by Android.
Did a bit more research and asked around and finally found the solutions.
While every tutorial out the there specifies the ratio to resize the images to as per DPI, But how to actually do it was proving to be quite difficult for a novice me.
Then used PNG Express and rest was all easy. They provided every image as per the developer specified ratio. While this tool is not free and requires first hand payment, please update if there's any better tool.
I am sorry if I wasn't very clear in my question.
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 been programming an application for Android. I want to target it for more devices(tablets, smartphones). I tried to find some info at http://developer.android.com/guide/practices/screens_support.html but it does not work correctly.
I want to automatically stretch images on different devices, not only in my testing device. I draw images for the mobile full screen (which has the same resolution as my mobile). But, for example in the tablet it draws incorrectly. I tried to change the size and it gives several folders(lhdpi, small, ...). When I tried to start it again in the tablet, it was bigger but still incorrect (there was a black space on the edges). I have several images in my application, and I want to retain the same size as in the mobile too. Please, help me.
Sorry for my spelling mistakes.
you have to maintain aspect ratio at your own . don't put same sized images in all folder (hdli, mdpi, ldpi), if this was the case they think why android provides different foldes ? put images in ratio 0.75 : 1 : 1.5 . it will work .
additionally read about 9-patch images, this will make your life much easier .
i am NOT an android developer and im trying to understand what they need in terms of graphical resources to make an app that functions across many android devices.
i have (tried to) read this page http://developer.android.com/guide/practices/screens_support.html , but find it somewhat bewildering. they talk as if screen density is the important thing "Supply alternative bitmap drawables for different screen densities" but then, if you dont know the size of the screen, you cant really think in terms of layout. is the idea to make buttons and logos that are the same size on all screens with the same density, such that on a large screen there is just a bunch of space, and on the small screen its all packed in tight? i dont understand how just thinking in pixel density gets me any closer to knowing what to provide.
are you supposed to create resources for every screen size AND pixel density? say it aint so.
anyway can somebody tell me... if you were developing an app what do you need for graphics? is it possible to provide graphics that are large and just let them scale down? is it inevitable that the devloper will have to mess with the graphics himself anyway? or can he be provided with sets of png files of certain sizes that will be ready to use?
thanks!
Here's what we do at my work place. Suppose we get a desing for the app. We make our designer create 3 psds versions for the same desing. the 3 psd's are for the 3 ranges of desnity. The size used for the psd are
240*320 (Low Density)
320*480 (Medium Density)
480*800 (High Density)
Most of the time when I write layouts, I use wrap_content which means a view must take the size of the content it wraps. Which works most of the time as I have a density specific version of the design so the image i use as background should be suitable. The thing to note is that, in android you can can put the 3 sizes of the same image in different folders such as drawable/ldpi, drawable/hdpi.
Eg: you have a bg.png and have a version for large phones and a version for small phones. You put the big bg.png into hdpi folder and the small png in the ldpi folder. Android will automatically select the appropriate image based on the phone density. But you need to make sure the file name is the same.
There are cases where you need to resize you background images without makeing the image looking too scaled. For this android uses the draw9patch tool. With this tool you can specify areas which can scale and areas that shouldn't scale.
9 Patch png's are your friend. Read up on them here:
http://developer.android.com/guide/topics/resources/drawable-resource.html#NinePatch
and here:
http://developer.android.com/guide/developing/tools/draw9patch.html
Those are your best bet for any kind of graphic that will stretch nicely (i.e. not gradients, they will come out slightly pixelated on some screens probably) The power of these types of images is that you can tell the system which pixels to repeat if it needs to stretch the graphic. This means that stretching can be done without loss of image quality (again depending on your image and how you choose to make the nine patch. The "show bad patches" button in the draw9patch program will show you potential problems. Hint: keep your repeatable pixels down to 1 on left and 1 on top and you'll have no problems with bad patches) Any graphics that can be made in to 9 patches will only need 1 size since the system can effectively make it whatever size it needs.
are you supposed to create resources for every screen size AND pixel density?
You may if you like. This would ensure that the application will look great across all devices. I understand that this is not feasible for all projects though. In general if you make separate resources for the different densities you'll get something that looks acceptable on most of the devices out there. All of the devices are classified as ldpi, mdpi, or hdpi (there may be an "extra high" level now too, I am not certain off the top of my head) So if you supply graphics for those 3 densities then the system will know where the device falls under and will pull the correct graphics.
is it possible to provide graphics that are large and just let them scale down?
Yes the system will scale down your graphics if needbe. But be aware there are consequences with this approach. First every time the system hast to scale a graphic up or down it is going to taking up CPU and memory to do so. This may not be an issue if you have relatively few things to scale, but if you have many it could cause noticeable lag time during on the lower power phones. Second, To my knowledge all of the graphics in android are raster, which means if you are letting the system scale something up or down image quality is going to decrease some. Again depending on the specific images this may be more or less noticeable on the actually device at runtime.
My best advice is supply them with resources of a few different sizes and run the app on as many different devices as you can. Once you see how your different resources look on the devices of different sizes you'll have a much better feel for which ones you need to supply to get the UI looking as consistent as possible across the largest swath of screen sizes and densities.
I have a client that gave me a .psd file that contains the entire screen of an Activity with all the graphics. The resolution is 480x800. The client wants the application to look identical to the one in the .psd file. The problem is that different devices have different resolutions and sizes. I know that the density is what really matters but how can I scale the graphics to look the same on all the devices? For example, I exported all the layers and recreated the screen in Android but, for some reason, the screen looks more crowded on a Nexus One (480x800).
One idea would be to create 9 patch images from the graphics and use for ImageViews android:background instead of android:src right?
Isn't it better to have a 320x480 resolution for the graphics? Or do I need for both resolutions? Also, I have to consider the height of the status bar which I understood it is 25dip but I am not certain about this.
So, to summarize, I am interested to find out what is the best way for a client to give you the mockups and graphics so that it is easy for the developer to implement according to the specifications.
That's something that's not easy to solve. Think of a webdesigner, one can't know all the possible resolutions and settings of every browser so he has to scale things accordingly.
In my opinion there are only three approaches here.
First: Let him state what devices he wants to support and only support those devices. Extract the layers with the size of the device with the highest resolution and scale them down on other devices.
E.g. If you have to support two devices with 480x800(2) and 240x300(1), export all images to be 480x800 and scale them down accordingly. Don't write a single application for every device.
Second: Export the graphics with the highest resolution possible and scale them down on all devices relative to the device being used. Imagine, again, a webdesigner. All he does is define margins, paddings, etc. and it will look nice in almost any browser. You should do the same and resize your elements on demand.
Third: Make the application fixed, e.g. define a size of 200x200 for your whole application and just fill everything larger than the screen with a certain color, e.g. black. This happens a lot with java ME applications, they look great on the hardware they were made for and are still playable on hardware that is beyond their time though they look pretty ugly.
Hope this helps,
Robin.