简体   繁体   中英

i need to know what different between screen size and screen density

in my android app i need to support multiple screens (all sizes and all screens ) so i have read about density and screen size but i don't know what i should to choose when i creat another xml file for every single activity .. a four xml files depend on screen size like this :

res/layout/your_layout.xml             (layout for normal screen)
res/layout-small/your_layout.xml       (layout for small screen)
res/layout-large/your_layout.xml       (layout for large screen)
res/layout-xlarge/your_layout.xml      (layout for extra large screen)

or five files to support all density like what i do with drawable png files plz help me to find the answer i need to what better and what the deference between them .

This is so simple like if you are using hard values like setText="22sp .Now it might good your test mobile but good for every mobile screen so you have to create four folder

**hdpi,xhdpi,xxhdpi,xxxhdpi**

Copy the same file in these 4 folders and adjust it. when the app runs on any mobile Android framework automatically detects the screen and gets one of them.

Note: if you are using not hard values like matchparent etc then no need to create 4 duplicate files of that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM