How to create different layout for Galaxy S3 and Nexus 7?

前端 未结 4 748
长情又很酷
长情又很酷 2021-02-03 15:17

I have created an android application which works properly for nexus 7. Inside resources folder, I have created two folders, layout, layout-land for Ne

相关标签:
4条回答
  • 2021-02-03 15:58

    you could create the layout by adding new folder under the res folder as layout-xlarge and layout-xlarge-large and u have to update the android manifest file as well to support the for higher resolution

    0 讨论(0)
  • 2021-02-03 16:00

    According to the Supporting Multiple Screensenter image description here

    Qualifiers like small, normal, large and xlarge is for Screen Sizes, which means Nexus 7 will use the resources with large qualifier, if you provide. Therefore before you create the folder with large qualifier, Nexus 7 will load the resources from default layout folder. As for ldpi, mdpi, hdpi and xhdpi is for the screen density.

    To solve your problem, you need:

    1. put the layout definitions for Galaxy S3 into layout, and layout-sw600dp for Nexus 7. Please refer to Android Developers Blog: Getting Your App Ready for Jelly Bean and Nexus 7

    2. put the resources (images or drawable stuff) for Galaxy S3 into drawable-xhdpi, and drawable-tvdpi or drawable-hdpi for Nexus 7.

    Hope it could help you, and please let me know if you have any other problems :)

    Here are some useful references:

    What layout is suitable for 720x1280 Android devices?

    Screen Width Qualifier

    0 讨论(0)
  • 2021-02-03 16:06

    You need one for xlarge and xlarge-land aswell

    Or you can do it programmatically by calling:

    Display displayparm= activity.getWindowManager().getDefaultDisplay();
    int width= displayparm.getWidth();
    int Height= displayparm.getHeight();
    

    and choosing layout from this info

    0 讨论(0)
  • 2021-02-03 16:07

    I have developed an application where i support multiple devices with different resolution and densities. with nexus 7 and galaxy s3 also one among them. galaxy s3 and nexus7 will obviously take from the large screen folder if u have layout-large folder in your project. But galaxy s3 falls under large hdpi category and nexus7 falls under large-tvdpi category. so it will be of great use if you have layout-large-hdpi and layout-large-tvdpi for s3 and nexus7 respectively.

    0 讨论(0)
提交回复
热议问题