根据Android中的屏幕尺寸和分辨率,加载不同的布局 /尺寸

发布于 2025-01-19 16:19:39 字数 279 浏览 5 评论 0 原文

我正在尝试为布局加载一个不同的XML文件,并在Android中尺寸。我尝试过创建一个Xlarge文件夹(用于10英寸平板电脑)和大文件夹(用于7英寸平板电脑)。因此,该文件夹称为values-xlarge和values-large或values-xlarge和值。 10英寸平板电脑的密度为224 ppi。

如果我使用这些布局文件,则使用10英寸平板电脑的“值”文件夹中的布局文件。如何为7英寸和10英寸平板电脑加载其他设计?以及哪个附录应用于文件夹?我发现小,中等,...,SW700DP,SW600DP和MDPI,HDPI等。

I am trying to load a different xml file for the layout and dimens in Android. I have tried creating an xlarge folder (for 10 inch tablet) and large folder (for 7 inch tablet). So the folder are called values-xlarge and values-large or values-xlarge and values-large. The 10 inch tablet has a density of 224 ppi.

If I use these layout files, the layout file from the values-large folder is used for the 10 inch tablet. How can I load a different design for 7 and 10 inch tablets? And which appendix should be used to the folder? I have found small, medium, large, ..., sw700dp, sw600dp and mdpi, hdpi, etc.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

把梦留给海 2025-01-26 16:19:39

我使用sw720dp,sw350dp-land,sw350dp等。
文件夹中的布局将用于最小宽度(SW ...)为720dp等的屏幕。 SW700DP将用于具有700DP或更多或更高的屏幕,直到下一个SW?DP布局。

它在显示独立的像素中,而不是常规像素。 IE。像素宽度除以屏幕DPI。您还可以在景观或肖像时添加一个或 - 端口以仅使用此布局。
查看此链接以获取更多信息。

I use sw720dp, sw350dp-land, sw350dp, etc.
The layout in the folder will be used for a screen with the smallest width (sw...) of 720dp, etc. ie. sw700dp will be used for screens with 700dp or more or up until the next sw???dp layout.

It is in Display Independent Pixels, not regular pixels. ie. pixel width divided by the screen dpi. You can also add a -land or -port to only use this layout if it is landscape or portrait.
Check out this link for more information.
https://developer.android.com/guide/topics/large-screens/support-different-screen-sizes

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文