I have the following predicament:
a) I have a designer who designs in photoshop and always uses 72dpi
b) I have developers who get his images and need them to be crisp and sharp for multiple android devices (larger/smaller in size, different dpis)
c) I don't want to confuse the designer with points, dps, etc. I want him to continue using what he knows: 72dpi canvas, all sizes to be specified in pixels
I've read many,many,many threads and links and tutorials and am confused.
Here is what I plan to do:
a) I plan to ask him to design screens using a 720px * 1280px screen. This is the resolution of a Samsung S3
b) I plan to ask him to specify all sizes of items inside reference screen, as well as their distance from phone boundaries in pixels too (I don't want to confuse him)
c) What the developers plan to then do, is take his assets and his reference screens, look at the sizes, and convert to dps in the android layout by basically adding applicable multipliers
d) What the designer also needs to do is resize images in his reference screen for ldpi, mdpi, xhdpi and xxhdpi, which my developers will move to the correct folders so they are picked up at runtime by Android depending on which devices they are testing on
e) NOTE: We plan to have the same layout for all sizes of phones - no different layouts, so assume that the design this person is creating will show well on all sizes
Questions:
1) The designer needs to know with this set up (72dpi PS screen,720x1280), when he is asked to resize images for different dpi buckets, what should he consider his reference screen as? MDPI or XHDPI as he will have to scale his images accordingly when generating them for the developer
2) I want to keep this simple for him. I don't want him to get confused on dpis. So I plan to tell him that forget about dpis when creating your photoshop reference screens -- just design for a 720x1280 screen # the usual 72dpi. Our developers will convert all distances to dps on their side. Any issues with this?
3) I also need to tell my developers how to convert his pixel distances to dps, so I need to tell him what they should treat this 720x1280 72dpi screen as. Is it MDPI or XHDPI?
Thanks
Questions: 1)
Designer needs to design the artwork with XHDPI resolution i.e 720x1280 px
and he need to down scale it with the ratio of
1 or 100% for XHDPI //baseline for designers
0.75 or 75% for HDPI
0.50 or 50% for MDPI
Developer no need to care anything about the artwork sizes or re-sizing them.
Question 2)
You might be confused about what PPI (pixels per inch) to set your deliverables at. Just leave them at the standard 72 PPI, and scale the images accordingly.
// check this Link
Question 3)
Ask your Developer to start design for MDPI first
1 for MDPI //baseline for developers
1.5 for HDPI
2 for XHDPI
use this link for dp calculator
1. Use wrap_content, fill_parent, or dp units when specifying
dimensions in an XML layout file.
2. Do not use hard coded pixel values in your application code
3. Do not use AbsoluteLayout (it's deprecated)
4. Supply alternative bitmap drawables for different screen densities
Ref here:
Maybe this guide could help you a bit
http://grahamtodman.co.uk/blog/2013/02/how-to-design-android-apps-in-photoshop-what-the-frak-is-a-dp/
Related
My company has a Android app. Our clients view the app with a Lenovo Tab M8. I am a designer tasked with recreating the current app experience in Figma so that our design team can have a design system and make accurate mockups. But I'm struggling to capture basic measurements (my experience is in Web and not Native apps).
The first question is, what is the width and length of the screen in pixels? I'm trying to create a basic screen template in Figma. I know the Lenovo display is 1280x800px with 16:10 screen ratio. But when I create a 1280x800 frame in Figma it's significantly larger than the physical device. I'm a little lost.
The other question is, I'm trying to recreate font sizes but I know the app uses dp and not px. I found a site that convert them, but I don't know if the tablet is LDPI, MDPI, or whatever.
https://www.pixplicity.com/dp-px-converter
Thanks for any insights you have.
You shouldn't need to know what density the tablet is, the point of using dp (density-independent pixels) is that everything will look pretty much the same size in the real world. The baseline density is LDPI, which is 160 pixels per inch - so 160dp is one inch on the screen.
XHDPI is 320 pixels per inch, so double the density - but converting 160dp to pixels on XHDPI devices involves multiplying it by 2, so the result is 320 pixels - which again corresponds to 1 inch on a 320dpi screen. See how it works?
So the pixel resolution isn't important, a tablet will be large in dp terms because they're physically bigger than a phone, more inches and all that. But if you're curious, if your M8 is the 2nd-gen one, according to the tech specs it's 4.8" on the 800 px axis (the one with the smallest bezels), and that works out to 166.7 DPI without taking those bezels into account - so it's an LDPI device!
I don't know anything about Figma, but so long as you're using dp measurements it should work ok? You have to be aware of the size of your screen though - when you said you created a frame 800 high and it was too big, if that was 800dp then 800 / 160 is 5" and your screen is only 4.8" high. Ideally your layout shouldn't require a specific physical size though, it should be able to adjust since different devices (even very similar ones) are different sizes - but I don't know how Figma works with that! That's just the way it works for the standard Android stuff
Also ideally fonts should use sp which is like dp but it has an additional scaling step depending on the user's font size settings on the device - it lets them shrink or enlarge text to their preference and for accessibility (the latter is especially important). Sometimes you want a fixed size for something that's more of a graphic element, but generally text should be scalable
If you want to know how to convert, have a look at the Material Type System - there's a chart there for converting between different units (also 1sp = 1dp for the Normal text size FYI). There's also a tool on there to create a type scale but only for stuff on Google Fonts - just saves you doing it yourself!
I apologize for the simple question, but I am a bit confused.
I am creating my first Android app. Functinally I am done. I am now working on the UI. According to this, I am required to provide multiple icons to support different screens and I understand this part.
So I created a vector image, and was about to export it to generate a number of icons to support multiple resolutions. However, I could not find the require DPI. According to this, I am supposed to support different DPIs, but the article does not explain how to do that.
Can you please advise me on how to select the proper DPI? Does it even matter? I thought it does, but maybe my understanding is wrong.
Thanks.
EDIT:
Just to clarify my question. When I am exporting an image from a vector to a raster image, I have to select its dimension (so in my case, 400px X 200px), and its dpi. So what should I choose for DPI? Is that the same DPI that will create different icon sizes? I am confused. Thanks again.
For what concerns dpi, I use to follow the screen dpi:
640 dpi for xxxhdpi screens
480 dpi for xxhdpi screens
320 dpi for xhdpi screens
240 dpi for hdpi screens
160 dpi for mdpi screens
120 dpi for ldpi screens
This way I'm sure the icons are appropriate to the screen resolution.
I'm also sure that I can skip some (if not all) the lower qualities, once I have the highest resolution graphics, because they will scale down nearly perfectly.
But, since I'm a perfectionist, nearly disturbs me.
So, I do provide all the resolutions graphics.
For what concerns dimensions use this cheatsheet: http://petrnohejl.github.io/Android-Cheatsheet-For-Graphic-Designers/#dimensions
You can make this experiment:
for an xhdpi screen, prepare a 800px X 400px image at 72 dpi (and no other images for other resolutions) and see how does it scale down in a lower resolution physical device, say an ldpi screen (it will look really bad)...
Then prepare a 800px X 400px image at 480 dpi (and no other images for other resolutions) and, after scaling (will look very good, on the same ldpi screen), compare the result to the previous one.
The difference will be evident on a physical device, much less on an emulator.
It's a way of doing things when you want to save some bytes on lower resolution pictures: just prepare the highest resolutions ones and let Android scale them down (it will scale down the ones it doesn't find in their folders).
I am writing my conclusion for the greater good. After further reading and investigation. It appears that DPI is not important when I am creating an image for a screen. So when I choose 400px X 200px, and assuming this will be for mdpi, then I should choose 800px X 400px for xdpi (and so on and so forth). The dpi should be ignored in all cases (does not matter if I chloose dpi of 90 or 600, as long as this is not for printing). On the other hand, if I am to print the image, then dpi is important.
EDIT
This is a great article about the topic. Please read it, it explains things very well.
I'd like to ask about one of the hardest thing for me (as a programmer) in android. As I make software mostly without designer (to be honest - totally without a designer) I can't figure out the following:
When I draw a png I use px (not dp) as image width.
I drew a button image with the following sizes:
hdpi: 318x45
mdpi: 212x30
(6 to 4 ratio)
and I would like my button be 80% width of Galaxy s2 which is
Screen Size in Pixels: 480 Pixel x 800 Pixel Screen Size in dp: 352dp
x 587dp
But also I would like to have the same width (80%) for hdpi 10' tablet. Is it possible or I'm missing something?
And is it possible to make 80% but not more than XXX pixel width?
You just need to provide different size images for different screen sizes and densities. When you think about it there's only a few different formats you need to worry about. You will then just create an "80%" size image for each of those formats, place them in the seperate drawable folders, and use them accordingly.
The android docs on supporting multiplce screen size and providing alternative resources are actually pretty comprehensive on how to do this.
Otherwise I'm sorry you don't have a designer. My tip - make your icons originally in Adobe Illustrator if you have it that way you can easily scale them to whatever size you need. As vector images they won't lose quality so you can change the size all you want. When you're ready, just export for web and devices at the size break points and you should be fine.
You have to use the android:layout_weight attribute.
Details outlined in a similar question here
I've been doing some reading on 4-screen sizes, and 4-densities for Android screen size suppor. I want to get a quick prototype app up and running. Is there any type of strategy for this or should I just (based on device size+density mostly used %'s) design for the normal screensize with med+high+xhigh dpi? Is there a best practice here?
//start design for MDPI first
Baseline phone mdpi 320x480
from that you can increase you drawables as 1.5 for HDPI and 2 for XHDPI
TVDPI it will scale automatically by using HDPI assets. 213/160 =1.33
Ref here:
1. Use wrap_content, fill_parent, or dp units when specifying
dimensions in an XML layout file.
2. Do not use hard coded pixel values in your application code
3. Do not use AbsoluteLayout (it's deprecated)
4. Supply alternative bitmap drawables for different screen densities
I've got a final app design made i Photoshop where everything is measured in PX.
Now I realize that Android apps are using DP for font-sizes and other things.
Is there any way I can convert PX to DP ?
On a more practical note, you have a few choices in increasing work and fidelty:
Have your resources scaled for 160 dots per inch, put them in your res/drawable directory, and let the OS scale them to look right on the device.
Make two copies of your resources: one at 160 dots per inch in your res/drawable and one at 240 dots per inch in your res/drawable-hdpi directory. Let the OS scale for the exact device starting from a pretty close number.
Decide that you don't want any scaling and have raw pixels, so put your assets in the res/drawable-nodpi directory. This means that at 320x480 (pixel) graphic might be 2 inches by 3 inches on one phone but only 1 1/3 inches by 2 inches on another screen.
Specify the exact scaling strategy for your work, using the draw9patch tool. This can be very useful for keeping the corners of boxes from getting the "jaggies" from scaling and for making full screen graphics cope with different aspect ratios.
Make separate graphics for every device you care about and fall back on scalable graphics for the rest. You will need to outrun zealots waving style guides trying to convince you not to do it this way.
Oh, and as a gotcha, specify sp for your fonts, instead of dp or pt. A 10 point font would be a 22 sp font [ =10 * (160/72) or = number of points times 2.222]. sp units scale with user preferences for small, medium, or large fonts.
From this list of the dimension units supported by Android, here's a description of DP:
Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".
This means that the "conversion" between pixels and DP will not be consistent -- on some devices, the ratio might be 1DP = 160px, but it could theoretically be anything. This is all well and good when you're setting the width of a button to, say, 100dp (since it will get rendered dynamically), but it presents a problem when you have images which must have a fixed size.
Read this page on "Supporting Multiple Screens" -- Android has something called resource directory qualifiers, which let you create size- and density-specific versions of your image resources. For example, for low-density screens, you could create a smaller version of your image and place it in the drawable-ldpi directory (or drawable-hdpi for high-density screens).
tl;dr You can't practically "convert from PX to DP" (since the ratio is not fixed), but you can create multiple versions of your images and tell Android which to use with resource directory qualifiers.
A pixel is PX and the DP or DIP are device independent pixels. I don't think that you need to convert these. But you can use scalable 9patch images using the draw9patch tool from the android tools.
I have same issue but now got the Solution.
Why you not use the online convertor to see which dp or px you have to for different resolution of android device ??
See this link: this link which helps me a lot and also helps you.
Enjoy coding.
This is a online DP/PX Converter tools: http://labs.rampinteractive.co.uk/android_dp_px_calculator/