[英]How to make Multi screens supported layout for 16:9, 18.5:9, 19:9
I have just developed an android app. 我刚刚开发了一个android应用。 The home page of this app have to scroll in 16:9 ratio (1080x1920 pixels)supported devices (including admob bottom banner).
此应用程序的首页必须以16:9的比例(1080x1920像素)滚动浏览受支持的设备(包括admob底部横幅)。 But it works pretty well in 19:9 ratio (1080x2280 pixels) and 18.5:9 ratio (1080x2220 pixels) supported devices.
但它在支持19:9比例(1080x2280像素)和18.5:9比例(1080x2220像素)的设备上效果很好。 See the below screenshots:
请参阅以下屏幕截图:
16:9 ratio (1080x1920 pixels), Samsung S6 edge+ 16:9比例(1080x1920像素),三星S6 edge +
19:9 ratio (1080x2280 pixels), OnePlus 6 19:9比例(1080x2280像素),OnePlus 6
How to make multi screens supported layout for 16:9(1080x1920), 18.5:9(1080x2220) and 19:9(1080x2280). 如何制作16:9(1080x1920),18.5:9(1080x2220)和19:9(1080x2280)的多屏幕支持的布局。 App link
应用程式连结
In order to have your app properly designed for all possible screens you need to make use of Android resources, specifically dimens and layout folder. 为了使您的应用适合所有可能的屏幕设计,您需要利用Android资源,特别是调暗和布局文件夹。
You can add specific resource files for dimensions and layout for different device resolutions/type. 您可以为不同设备分辨率/类型的尺寸和布局添加特定的资源文件。 The way you can do that is, inside your
res
folder you will find a values
folder where you store your dimens.xml and a layout
folder where you store your XML. 为此,您可以在
res
文件夹中找到一个values
文件夹,其中存储dimens.xml和一个layout
文件夹,其中存储XML。
You can add values for multiple resolutions by cloning the values folder and renaming it adding -hdpi
, -mdpi
, -xhdpi
, etc 您可以通过克隆values文件夹并添加
-hdpi
, -mdpi
, -xhdpi
等重命名来添加多种分辨率的值
By doing that, the dimens inside those folders will point to the specified resolution, xhdpi
for example. 这样,这些文件夹内的暗度将指向指定的分辨率,例如
xhdpi
。
You can do the same with layout folder and create specific XML for tablet and phone. 您可以对布局文件夹执行相同操作,并为平板电脑和手机创建特定的XML。
You can check the specifications of each type per resolution in this SO link . 您可以在此SO链接中按分辨率检查每种类型的规格。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.