Android Tutorial Supporting multiple screens - tips and best practices

Status
Not open for further replies.

jamesnz

Active Member
Licensed User
Longtime User
If i need different layout for landscape and portrait and I set variant specific scripts for say ( 480 x 320) will this work on all devices of do i have to set a landscape layout for all sizes ?
 

ArminKH

Well-Known Member
Hi
I have one problem
When i use dip my view's width and height is different in vitrual device with density 1 and blue stack with density 1
I think that's should be same on any density by using dip
Is this wrong?
 

ArminKH

Well-Known Member
Erel my device has 540pixel with 1.5 scale rate in width but the width of vitrual device (320*480)is larger in real
320>360????!!!!
 

ArminKH

Well-Known Member
It depends on how you measure the width and height.

The physical size (which is the important factor) should be more or less the same. The number of pixels will not be the same.
I want dock an item in left top without any change in width or height so i use dip for example i have an item with 35*35 size in 320*480 (density 1) and i use 35dip for this
But the physical size of item is different in some device with different density or in blue stack with density 1
i know for example 30 pixel in density 1.5 should be 45 pixel but i think the physical size should not be different when we use dip
Is this wrong?
 
Last edited:

ArminKH

Well-Known Member
Don't confuse dpi (dots per inch) and dip (density independant pixels).
So, the physical dimension for a given number of dips can be somewhat different.
so how we can prevent from changing the dimension of viewes?
 

ArminKH

Well-Known Member
What accuracy do you expect ?
The physical dimensions are almost the same with dips but not exactly.
According to the documentation 48dip is equal to about 9mm.
To get the xdpi and ydpi values look at THIS post.

plz see this screenshot



this is a button with 100dip*100dip dimensions
but the physical size in vitrual device is too different with blue stack
 

klaus

Expert
Licensed User
Longtime User
As already written, dip values do not garantie exactly the same physical dimensions, that's how Android works.
If you really need 'exact' physical dimensions (the routine is in the second link in my previous post) you should get the exact x and y dpi values and calculate the pixels needed.
Are you sure that the dimensions of the virtual devices are correct ?
Why do you want 'exactly' the same physical dimensions ?
 

ArminKH

Well-Known Member
dimensions on phone<bluestack<vitrual device
yes kluas its correct
i want my top menu be same on every phone similar to viber or other apps
can u attache for me a little example?
 

klaus

Expert
Licensed User
Longtime User
I have never calculated exact physical dimensions because I don't bother if there are small differences.
If you have a device with 3'' screen and another one with a 3.5'' screen both with a density of 1.
The dimensions on the 3.5'' screen will be a bit bigger than on the 3'' screen.
Not sure if the look on both devices with exactly the same physical dimensions will be good.
Having the dimensions more proportional to the screen dimensions will look better.
It's already not that simple to define good looking layouts for different screen sizes without adding a new parameter which, in my opinion, will only complicate the whole stuff.
 

ArminKH

Well-Known Member
ok thank u very much klaus
 

MrKim

Well-Known Member
Licensed User
Longtime User


RE: The scale values can be one of the following values: 0.75, 1.0, 1.33, 1.5 and 2.

With Android 7 this is evidently no longer true. My 1280 X 800 Tablet, depending on how the new feature "Display Size" is set, returns a scale of .85, 1(default), 1.125, and 1.25.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…