[英]How to add screen layouts for different screen sizes in android? (Update 2020)
I tested my application for screen sizes for 6 inches - 6.5 inches(on a one plus 6t/7t) and above and it's scaling the UI elements properly for it.我测试了我的应用程序的屏幕尺寸为 6 英寸 - 6.5 英寸(在一加 6t/7t 上)及以上,它正在为它正确缩放 UI 元素。 But when I tested the application for screen sizes of 5 - 5.5inches, it's going out of the constraints and off the screen.
但是,当我针对 5 - 5.5 英寸的屏幕尺寸测试应用程序时,它会超出限制并脱离屏幕。
These are the things that I have tried:这些是我尝试过的事情:
wrap_content
and match_parent
with most of the UI elements(Textviews, Buttons to name a few)wrap_content
和match_parent
与大多数 UI 元素(Textviews,按钮仅举几例)Lastly, I came across their solution of having a different screen layout for different screen size.最后,我遇到了他们为不同屏幕尺寸提供不同屏幕布局的解决方案。 For this, what would I have to do?
为此,我该怎么办? Create a new Layout and copy my Design XML text in the newly created layout and adjust scaling accordingly or is there a better approach for doing so?
创建一个新布局并在新创建的布局中复制我的设计 XML 文本并相应地调整缩放比例,或者有更好的方法吗?
Also, any other suggestions or any other approach to solve this would also help.此外,任何其他建议或解决此问题的任何其他方法也会有所帮助。
Edit 1:编辑1:
So I figured something out, The UI is not setting correctly for xxhdpi resolutions.所以我想通了,用户界面没有正确设置 xxhdpi 分辨率。 To compare, two screen sizes of similar sizes (1080x1920) having 420dpi and xxhdpi resolutions, the former works correctly but the latter does not.
比较一下,具有 420dpi 和 xxhdpi 分辨率的两个相似尺寸 (1080x1920) 的屏幕尺寸,前者可以正常工作,但后者不能。 Any clues on how can I create or deal with xxhdpi resolutions?
关于如何创建或处理 xxhdpi 分辨率的任何线索?
[try with this,you can update AS] [试试这个,你可以更新AS]
[1]: https://i.stack.imgur.com/oLqHI.png [1]:https://i.stack.imgur.com/oLqHI.png
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.