Android supporting all tablets - categorize drawables and layouts

后端 未结 5 591
野的像风
野的像风 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-31 12:17

    AFAIK there are two kinds variables for device display : pixel density and screen dimensions. Both are theoretically independent, though in market both vary together from low end to high end devices.

    Pixel density demands for different bitmap resolutions and level of detail (36X36 to 96X96 icons for example) .

    Screen dimensions demand for better use of real estate ( Multi activity layout for phones, combined fragmented layout for tablets, for example). Not as important as pixel density, but good to have, because tablet users might find a phone layout too bland, and waste of screen space.

    So:

    • To cover most pixel densities you will have to have different versions of drawables : ldpi,mdpi,hdpi and xhdpi. Prefer nine-patch drawables, these are a lot better at fitting everywhere.

    • To cover most screen sizes you will have to have different layout arrangements, and a responsive layout design for small,large and xlarge values. Also, different layouts for portrait, and landscape orientations are good to have sometimes.

    • Android lets you mix configuration combinations too. E.g. drawable-large-hdpi etc.

    • Avoid hard coded pixel co-ordinated and dimensions at all costs, use density or percentage.

    • Its Way better to have one flexible nine-patch drawable than to have different drawables for different screen sizes.

提交回复
热议问题