Different resolution support android

前端 未结 8 1317
北海茫月
北海茫月 2020-11-22 04:21

Edited Question:

Mobile Resolution:
I would like to design different screen dpi like following resolutions.
320x480,
48

8条回答
  •  盖世英雄少女心
    2020-11-22 04:30

    I think this is a good answer:

    Text size and different android screen sizes

    But here how you can do it with screen resolution :

    You can create "values" resource directory for each resolution like

    values-wWIDTHp-hHEIGHTdp (you can also use values-wWIDTHp or values-hHEIGHTdp)
    for example: 320*480 will be values-w320p-h480dp
    

    In each dir (including default values dir) create a file named "dimens.xml" with content:

     for exmaple (the value related to the resolution):
     10sp
    

    Now you can use the "@dimen/def_font_size" or create a style in the default values directory.

    Add this to the "styles.xml":

    
    

提交回复
热议问题