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

不打扰是莪最后的温柔 提交于 2019-12-02 21:22:51
dumbfingers

According to the Supporting Multiple Screens

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

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

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!