I am designing screen from Zeplin. (Zeplin provides each item attributes in dp)
Following is the horizontal recycler view design example with 4 items from Zeplin.
360 dp means 1080 for xxhdpi devices
I am testing my code on two 1080 devices with different dpi
Samsung c5 [1080 x 1920 pixels, 16:9 ratio (480dpi)]
Nexus 5X [1080 x 1920 pixels, 16:9 ratio (420dpi)]
I am facing spacing issue in Nexus-5x, the Zeplin design works great
on Samsung-c5.
Samsung-c5 result
Nexus-5x result - spacing issue in horizontal recycler view
QUESTION:
Why the design in different on same resolution (1080x1920) devices (different dpi). How can I make it look same on each and every device like facebook does with its status
Similar Questions:
How to use 1080x1920: 420 dpi - Android studio
Android xxhdpi, 420 dpi and 480 dpi
XXHDPI Layout different on different XXHDPI devices
Sol1 - Calculator app different layout on same screen size but different DPI (420 DPI vs 480 DPI) - Android Developer
Sol2 - Android layout folders for different screen sizes
Placing dimens in values-w410dp worked, as mentioned in the answer here
Related
Hey guys I'm dealing with responsive design on Android with specifications below:
My app should not scroll.
I want to design it for all existing devices.
For now I opt for values/dimens file that I created for all dimension aspect in the app.
So I created w480dp, w300dp for widths and h750dp and h400dp for heights.
When I test my app in emulators:
320X480 Mdpi
480 x 854 Mdpi
480 x 800 Hdpi
768 x 1280 Xhdpi
They tooks all the w300dp X h400dp
In my testing device (galaxy S6 1440x2560) it took also w300dp X h400dp.
Anyone can tell me what qualifier should I use or even if I have a comprehension issue.
Hi, having bit of a trouble fitting the different src(images) to fit nicely to all the different screen sizes.
Do i have to add different imageSolutions of the image in the drawable map? Any smart solutions?
Android images require five separate sizes for different screen pixel densities. Icons for lower resolution are created automatically from the baseline.
mdpi (Baseline): 160 dpi - 1×
hdpi: 240 dpi - 1.5×
xhdpi: 320 dpi - 2×
xxhdpi: 490 dpi - 3×
xxxhdpi: 640 dpi - 4×
here http://iconhandbook.co.uk/reference/chart/android/ is more information
The X means the size of your baseline image
Try using layouts to center the image, play with weigth of layouts
Is it possible to make a layout for this nexus 4 resolution . my app give problem with custom views.
i have
layout-hdpi
layout-xhdpi
layout-xxhdpi
i know xhdpi includes 768 x 1280 and 720 x 1280 .
dpi only partially depends on resolution. It is a measure of how tightly the pixels are packed on the screen. Thus, it is a function of both resolution, as well as the physical size of the screen.
Saying 768 x 1280 px = xhdpi may be correct for some devices, but incorrect for others. For example, what if you have a 10 inch screen that has that resolution? That would most likely be ldpi.
In order to support multiple screens, please follow this guide: http://developer.android.com/guide/practices/screens_support.html
You may want to use dp's instead of pixels in your layouts for setting widths and heights. You can then customize layouts based on the current width of the device by using layout directories such as layout-sw320dp ("smallest width 320 dp").
Dear Android Developers,
as far as I know, Android has 4 different types of screen resolution :
LDPI << ignore this, because I won't build my app in this resolution
MDPI : 320 x 480
HDPI : 480 x 720
XHDPI : 640 x 960
now, Google Nexus 4 has screen resolution : 768 x 1280, which I assume this categorised as XHDPI model. *please correct me if I'm wrong.
now take a look at my picture...
so, if I put XHDPI size (red area) on top of Nexus 4 screen (grey area) you'll see what I see.
now, if I have 4 white boxes horizontally and 6 white boxes vertically on red area (PSD design). what it looks like on Nexus 4 screen resolution?
can we programatically add more boxes (blue boxes) to fill the empty space? or Android will automatically stretch that red area until covers all grey area? which means all of white boxes will be stretched too...
that's all I need to know... thanks.
You should watch Roman Nurik's Design Bytes: Density-Independent Pixels video.
First, stop thinking in pixels. Think of devices using density-independent pixels. The buckets that Android uses (ldpi, mdpi, etc.) are not measured in pixels; they are measured in dots-per-inch (DPI).
Those buckets are actually:
LDPI: 120 DPI
MDPI: 160 DPI
HDPI: 240 DPI
XHDPI: 320 DPI
The Nexus 4 has a DPI of precisely 320.
Screen size and Screen DPI are different things. Check https://developer.android.com/guide/practices/screens_support.html
I am using "layout-sw360dp" for both Galaxy S4 and Nexus 4 devices but in my screen displaying some space on Galaxy S4. so can i make different layout for both Galaxy S4 and Nexus 4. if it is possible then please give me the solution.
For Galaxy s4 use layout-xxhdpi
For Nexus 4 use layout-xhdpi
Galaxy S4 -- 1080 x 1920 pixels -- 5.0" -- 441 ppi -- xxhdpi
Nexus 4 -- 1280 x 768 pixels -- 4.7" -- 320 ppi -- xhdpi
You have to make different images to fit to the resolution of these devices
As per other answers one device is 640 x 360 dp and the other 640 x 384 dp.
You don't want to make a different layout for them, because you will sooner or later see a device 640 x 372 dp or 640 x 388 dp.
Instead make your layout elastic and don't hardcode pixels (density independent pixels can also be badly hardcoded).
ok here goes...
for reference
this is older layout folder naming conventions but you get the point.
You must convert everything to mdpi to go into the following buckets.
buckets for layouts are :
xlarge 960 x720 min
large 640 x480 min
normal 470 x 320 min
small 426x 320 min
scaling ratio
3:4:6:8:12
this means that you must multiple ldpi * 3/4 to go from ldpi to mdpi
and you must multiple mdpi * 4/6 to go from mdpi to hdpi
and you must multiple hdpi * 6/8 to go from hdpi to xhdpi
and you must multiple xhdpi * 8/12 to go from xhdpi to xxhdpi
so to answer the question....
s4 is xxhdpi which means the scaling ratio is 4/12 or 1/3. This means that you have to convert from xxhdpi to mdpi to place in a layout folder properly.
so 1080 * 1/3 = 360
and 1920 * 1/3 = 640
so this would place it in a normal layout folder
nexus 4 is xhdpi which means the scaling ratio is 4/8 or 1/2. 4 This means that you have to convert from xhdpi to mdpi to place in a layout folder properly.
so 1280 * 1/2 = 640
and 768 * 1/2 = 384
so this would place it in a normal layout folder as well.
ok, so this doesn't quite cut it because they are different resolutions. we can make up folders with the new naming conventions. for example the smallest width for the s4 is 360 while the smallest width for the nexus 4 is 384. so folders could be sw360dp and sw384dp.
you could also name the folder layout-xxhdpi which would catch the s4 but not the nexus 4
be aware: Just to throw another one out there what if you had an s3 as well. that would go in the sw360dp folder as well. so I guess you would have to differ between them as well. if you used layout-xxhdpi above then you could use sw360dp here and sw384dp above as well. cover them all.
thanks
Both these phones have different screen size and resolution , that leads to different density as well .
As per my knowledge -
Galaxy s4 has 1080 x 1920 pixels, 5.0 inches (~441 ppi pixel density).
And
Nexus 4 has 1280 x 768 pixels, 4.7 inches (320 ppi ).
You will have to design the layouts (and images as well ) according to the phones specifications.
for nexus 4 use below layout.
layout-sw360dp
both galaxy s3 and nexus 4 have same layouts.