Issue
I measure that Nexus 5 is using 592dp height. Even though it has 640dp, part of them are used as by the soft button.
So I have a layout, which resource dimen value I defined in all 3 dimens.xml below with different values.
res/values/dimens.xml
res/values-h592dp/dimens.xml
res/values-h640dp/dimens.xml
I'm expecting it to pick up the one from values-h592dp
. However it is picking up from the default value
folder instead. Why is this so? Did I miss anything?
Solution
Apparently not like width, we can't set the exact Height as per the device cauculated (e.g. 592dp for Nexus 5 or 640dp for Samsung 7). The height that it need to set is the one the calculated height - the status bar height.
use h509dp for Samsung SII that has height 533.33dp - 24dp (status bar)
use h567dp for Nexus 5 that has 592dp height - 25dp (status bar)
use h616dp for Samsung S7 that has 640dp height - 24dp (status bar)
use h615dp for Samsung Note II that has 640dp height - 25dp (status bar)
For Samsung S7 and Note II, they could share h615dp. Refer to https://medium.com/@elye.project/an-important-note-when-managing-different-screen-height-3140e26e381a#.tljbmvc2x for more illustration of this.
Answered By - Elye
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.