简体   繁体   English

如何制作16:9、18.5:9、19:9的多屏幕支持的布局

[英]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.

相关问题 如何使我的布局适合所有屏幕 - How to make my layout fit in all screens 如何在Android中制作没有选项卡布局的滑动视图屏幕? - How to make a swipe view screens without tab layout in android? 如何使布局支持android studio中的所有屏幕 - how to make layout support all screens in android studio 我怎样才能使屏幕具有多个屏幕,如 iOS 或 android 多任务操作 flutter 应用程序 - how can i make screen have multi screens like iOS or android multi tasking action flutter app 如何制作多窗格景观布局? - How to make a Multi-pane landscape layout? 如何在API18-19中使layout_weight与其他API级别相同? - How to make the layout_weight work the same for API18-19 as for the other API levels? 如何使大屏幕和大屏幕的布局保持一致?总会有一些空白 - How to make layout consistent for small and large screens ?There's is always some whitespace left 横向定位:Android中多屏的正确布局文件夹是什么 - Landscape Orientation: What are the correct layout folders for multi-screens in android 如何在ActionBarSherlock中的xlarge屏幕上更改布局 - How to change layout on xlarge screens in ActionBarSherlock 如何在小屏幕布局上禁用横向 - How to disable landscape on small screens layout
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM