简体   繁体   中英

Android screen compatibility - is it crucial to provide different layouts for different screen sizes?

A friend of my and I are working on an android app and we have an argument regarding to the proper way for supporting different screen sizes.

according to the following link ( http://developer.android.com/guide/practices/screens_support.html ), one of google reccomendations is to create different xml layout files for each acttivity/fragment. for one hand - we would like that our application will run smoothly on several types of devices. from the other hand - we would like to work smart and effective, and to save valuable time.

therefore my question is what is the proper why to work? should we generate several xml files for each activity? or maybe to the complicated ones only? or maybe we can work out without creating multiple layout at all? it seems like too much effort..

Thanks

one of google reccomendations is to create different xml layout files for each acttivity/fragment

That is not their recommendation. Quoting the documentation that you linked to, with emphasis added:

By default, Android resizes your application layout to fit the current device screen. In most cases, this works fine . In other cases, your UI might not look as good and might need adjustments for different screen sizes. For example, on a larger screen, you might want to adjust the position and size of some elements to take advantage of the additional screen space, or on a smaller screen, you might need to adjust sizes so that everything can fit on the screen.

Google's recommendation,l therefore, is to have different versions of a resource for different screen sizes only where this is needed , where you determine if it is needed by trying it, seeing what it looks like, and determining that you cannot readily address any problems you are seeing by modifying the existing resource.

should we generate several xml files for each activity? or maybe to the complicated ones only? or maybe we can work out without creating multiple layout at all?

That is impossible to answer in the abstract, just as it is impossible to say whether you need custom CSS rules for different screen sizes for every possible Web page.

just try to make a layout but add multiple images xml to drawable for different different screens. doing this you can run your app on any size of screen (Not in every cases but it will help you).

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