Android supporting all tablets - categorize drawables and layouts

后端 未结 5 578
野的像风
野的像风 2021-01-31 11:40

I have seen many thread discussing this problem in stackoverflow (like this, this and this), and I have read the documentation about supporting multiple screens, and designs. Bu

5条回答
  •  醉话见心
    2021-01-31 12:29

    Actually Tablets are categorized by size not by dpi, i.e 7" tab is drawable-large while your 10" tab is drawable-xlarge. And now you can again categorized by dpi like drawable-large-hdpi which means it is a Tab of 7" which having High Density.

    you can use SW smallest width concept to target that, see Application Skeleton to support multiple screen and make calculation for the same.

    Tablet Tablets are categorized into two size.

    7" (1024X(600-48(navigation bar))) = 1024 X 552 (drawable-large)
    10" (1280X(800-48(navigation bar))) = 1280 X 752 (drawable-xlarge)

    and for 2560x1600 calculate SW dp with formula

    px= Device's width
    dpi= Device's density

    formula given

    px = dp * (dpi / 160)
    

    interchange formula if you have px's value

    dp = px / (dpi / 160)
    

    so drawable-swxxxdp will do the job

提交回复
热议问题