HK40068134B - Method and apparatus for adjusting interface layout, device, and storage medium - Google Patents
Method and apparatus for adjusting interface layout, device, and storage medium Download PDFInfo
- Publication number
- HK40068134B HK40068134B HK42022057472.7A HK42022057472A HK40068134B HK 40068134 B HK40068134 B HK 40068134B HK 42022057472 A HK42022057472 A HK 42022057472A HK 40068134 B HK40068134 B HK 40068134B
- Authority
- HK
- Hong Kong
- Prior art keywords
- target
- adaptation
- screen
- application interface
- interface
- Prior art date
Links
Description
技术领域Technical Field
本发明实施例涉及前端技术领域,尤其涉及一种调整界面布局的方法、装置、设备及存储介质。The embodiments of the present invention relate to the field of front-end technology, and in particular to a method, apparatus, device and storage medium for adjusting interface layout.
背景技术Background Technology
随着终端设备的发展,对于终端设备的需求日益增长。为适应不同的需求,终端设备上可以安装各种应用程序。而应用程序的界面布局在很大程度上影响着目标对象对应用程序的使用体验。With the development of terminal devices, the demand for them is increasing. To meet different needs, various applications can be installed on terminal devices. The interface layout of these applications greatly influences the user experience.
相关技术中,一个应用程序的基准应用界面往往对应一个基准屏幕的基准分辨率,如,1280px*720px,而不同终端设备的待适配屏幕对应的目标分辨率可能是不同的;因此,为了与不同的终端设备适配,相关技术基于基准分辨率分别与不同目标分辨率之间的比例关系,相应调整基准应用界面中呈现的界面元素的物理尺寸,获得在不同终端设备上展示的适配应用界面。In related technologies, the baseline application interface of an application often corresponds to the baseline resolution of a baseline screen, such as 1280px*720px. However, the target resolution of the screen to be adapted for different terminal devices may be different. Therefore, in order to adapt to different terminal devices, related technologies adjust the physical size of the interface elements presented in the baseline application interface according to the proportional relationship between the baseline resolution and different target resolutions, so as to obtain the adapted application interface displayed on different terminal devices.
由于不同终端设备对应的目标分辨率是不同的,故不同目标分辨率与基准分辨率的比例关系也是不同的,因此,采用不同的比例关系,对同一基准应用界面中的界面元素进行物理尺寸调整获得的适配应用界面也是不同的,即在不同终端设备上呈现的适配应用界面中的界面元素的物理尺寸不同,进而影响应用程序界面的视觉呈现效果。Since different terminal devices have different target resolutions, the ratio between different target resolutions and the baseline resolution is also different. Therefore, by using different ratios to adjust the physical size of the interface elements in the same baseline application interface, the resulting adapted application interfaces will also be different. That is, the physical size of the interface elements in the adapted application interface presented on different terminal devices is different, which in turn affects the visual presentation effect of the application interface.
发明内容Summary of the Invention
本申请实施例提供了一种调整界面布局的方法、装置、设备及存储介质,用于提高应用程序界面的视觉呈现效果。This application provides a method, apparatus, device, and storage medium for adjusting the layout of an application interface to improve the visual presentation of the application interface.
一方面,本申请实施例提供了一种调整界面布局的方法,该方法包括:On one hand, embodiments of this application provide a method for adjusting the interface layout, the method comprising:
响应于针对目标应用的触发操作,通过目标屏幕展示所述目标应用的适配应用界面,其中,所述适配应用界面中包括多个界面元素,每个所述界面元素在所述适配应用界面中呈现的第一物理尺寸,与相应的界面元素在基准应用界面中相应呈现的第二物理尺寸相同;In response to a trigger operation for a target application, an adapted application interface of the target application is displayed on the target screen. The adapted application interface includes multiple interface elements, and the first physical size of each interface element in the adapted application interface is the same as the second physical size of the corresponding interface element in the base application interface.
每个所述第一物理尺寸,是基于所述界面元素在所述适配应用界面中的目标虚拟像素尺寸,以及所述目标屏幕的目标点密度确定的,所述目标虚拟像素尺寸与所述界面元素在基准应用界面中的基准虚拟像素尺寸相同。Each of the first physical dimensions is determined based on the target virtual pixel size of the interface element in the adapted application interface and the target point density of the target screen, wherein the target virtual pixel size is the same as the reference virtual pixel size of the interface element in the base application interface.
一方面,本申请实施例提供了一种应用界面适配的装置,该装置包括:On one hand, embodiments of this application provide an application interface adaptation device, the device comprising:
展示模块,用于响应于针对目标应用的触发操作,通过目标屏幕展示所述目标应用的适配应用界面,其中,所述适配应用界面中包括多个界面元素,每个所述界面元素在所述适配应用界面中呈现的第一物理尺寸,与相应的界面元素在基准应用界面中相应呈现的第二物理尺寸相同;The display module is used to respond to a trigger operation for the target application and display the adapted application interface of the target application through the target screen. The adapted application interface includes multiple interface elements, and the first physical size of each interface element in the adapted application interface is the same as the second physical size of the corresponding interface element in the base application interface.
每个所述第一物理尺寸,是基于所述界面元素在所述适配应用界面中的目标虚拟像素尺寸,以及所述目标屏幕的目标点密度确定的,所述目标虚拟像素尺寸与所述界面元素在基准应用界面中的基准虚拟像素尺寸相同。Each of the first physical dimensions is determined based on the target virtual pixel size of the interface element in the adapted application interface and the target point density of the target screen, wherein the target virtual pixel size is the same as the reference virtual pixel size of the interface element in the base application interface.
可选地,还包括处理模块;Optionally, it may also include a processing module;
所述处理模块具体用于:The processing module is specifically used for:
基于所述界面元素的目标虚拟像素尺寸和所述目标点密度,确定所述界面元素在所述适配应用界面中的目标像素尺寸;Based on the target virtual pixel size of the interface element and the target point density, determine the target pixel size of the interface element in the adapted application interface.
基于所述界面元素的目标像素尺寸,确定所述界面元素在所述适配应用界面中呈现的第一物理尺寸。Based on the target pixel size of the interface element, determine the first physical size of the interface element as presented in the adapted application interface.
可选地,所述处理模块还用于:Optionally, the processing module is further configured to:
基于所述目标屏幕的目标分辨率和所述目标屏幕的原始屏幕密度,确定所述目标屏幕的有效宽度和有效高度;Based on the target resolution and the original screen density of the target screen, the effective width and effective height of the target screen are determined;
基于所述有效宽度与所述基准屏幕的基准宽度之间的第一差异度,以及所述有效高度与所述基准屏幕的基准高度之间的第二差异度,确定所述目标屏幕的标准化调整方向;Based on the first difference between the effective width and the reference width of the reference screen, and the second difference between the effective height and the reference height of the reference screen, the standardization adjustment direction of the target screen is determined;
基于所述标准化调整方向,对所述目标屏幕的原始像素密度进行调整,获得目标点密度。Based on the standardized adjustment direction, the original pixel density of the target screen is adjusted to obtain the target pixel density.
可选地,所述处理模块还用于:Optionally, the processing module is further configured to:
基于所述有效宽度与所述基准屏幕的基准宽度之间的第一差异度,以及所述有效高度与所述基准屏幕的基准高度之间的第二差异度,确定所述目标屏幕的标准化调整方向之前,基于所述有效宽度与所述基准宽度的比值,确定第一差异度;以及基于所述有效高度与所述基准高度的比值,确定第二差异度;Before determining the standardization adjustment direction of the target screen based on a first difference between the effective width and the reference width of the reference screen, and a second difference between the effective height and the reference height of the reference screen, the first difference is determined based on the ratio of the effective width to the reference width; and the second difference is determined based on the ratio of the effective height to the reference height.
确定所述第一差异度或所述第二差异度小于1。Determine that either the first difference or the second difference is less than 1.
可选地,所述处理模块具体用于:Optionally, the processing module is specifically used for:
若所述第一差异度大于所述第二差异度,则将高度方向作为所述目标屏幕的标准化调整方向;If the first difference is greater than the second difference, then the height direction is used as the standardization adjustment direction of the target screen;
若所述第一差异度小于等于所述第二差异度,则将宽度方向作为所述目标屏幕的标准化调整方向。If the first difference is less than or equal to the second difference, then the width direction is used as the standardization adjustment direction of the target screen.
可选地,所述处理模块具体用于:Optionally, the processing module is specifically used for:
基于所述目标分辨率,确定所述目标屏幕在所述标准化调整方向上对应的目标像素数量;Based on the target resolution, determine the number of target pixels corresponding to the target screen in the normalization adjustment direction;
基于所述目标像素数量,以及所述基准屏幕在所述标准化调整方向上对应的基准像素数量,对所述原始屏幕密度进行调整,获得目标屏幕密度;Based on the target number of pixels and the reference number of pixels of the reference screen corresponding to the normalization adjustment direction, the original screen density is adjusted to obtain the target screen density;
基于所述目标屏幕密度以及所述基准点密度,对所述原始像素密度进行调整,确定所述目标点密度。Based on the target screen density and the reference point density, the original pixel density is adjusted to determine the target point density.
可选地,所述适配应用界面还包括多个适配信息引导区,每个适配信息引导区用于展示与一类引导信息关联的界面元素;Optionally, the adapted application interface also includes multiple adaptation information guidance areas, each of which is used to display interface elements associated with a type of guidance information;
每个所述适配信息引导区在所述适配应用界面中呈现的物理宽度,是根据所述适配信息引导区的初步像素尺寸和所述目标屏幕的目标宽度确定的,其中,所述适配信息引导区的初步像素尺寸,是基于相应的基准信息引导区在所述基准应用界面中的基准虚拟像素尺寸,以及所述目标点密度确定的;The physical width of each of the adaptation information guide areas presented in the adaptation application interface is determined based on the initial pixel size of the adaptation information guide area and the target width of the target screen. The initial pixel size of the adaptation information guide area is determined based on the reference virtual pixel size of the corresponding reference information guide area in the reference application interface and the target point density.
每个所述适配信息引导区在所述适配应用界面中呈现的物理高度,以及每个所述适配信息引导区展示的界面元素的目标数量,是根据所述适配信息引导区的初步像素尺寸以及所述目标屏幕的目标高度确定的。The physical height of each adaptation information guide area presented in the adaptation application interface, and the target number of interface elements displayed in each adaptation information guide area, are determined based on the initial pixel size of the adaptation information guide area and the target height of the target screen.
可选地,所述处理模块还用于:Optionally, the processing module is further configured to:
基于基准宽度范围和所述基准屏幕的基准点密度,确定所述适配信息引导区的目标宽度调整范围;Based on the reference width range and the reference point density of the reference screen, the target width adjustment range of the adaptation information guidance area is determined;
基于所述初步像素尺寸,确定所述适配信息引导区的初步像素宽度;Based on the initial pixel size, determine the initial pixel width of the adaptation information guidance area;
基于所述目标屏幕的目标宽度以及所述宽度调整范围,对所述初步像素宽度进行调整,获得所述适配信息引导区的目标像素宽度,并基于所述目标像素宽度,确定所述适配信息引导区在所述适配应用界面中呈现的物理宽度。Based on the target width of the target screen and the width adjustment range, the initial pixel width is adjusted to obtain the target pixel width of the adaptation information guide area, and based on the target pixel width, the physical width of the adaptation information guide area presented in the adaptation application interface is determined.
可选地,所述处理模块具体用于:Optionally, the processing module is specifically used for:
将所述基准宽度范围对应的预设点密度和所述基准屏幕的基准点密度的比值,作为所述基准宽度调整范围的调整比例;The ratio of the preset point density corresponding to the reference width range to the reference point density of the reference screen is used as the adjustment ratio of the reference width adjustment range;
将所述基准宽度调整范围的上下边界值,分别与所述调整比例相乘,获得所述适配信息引导区的目标宽度调整范围。The target width adjustment range of the adaptation information guidance area is obtained by multiplying the upper and lower boundary values of the reference width adjustment range by the adjustment ratio.
可选地,所述处理模块还用于:Optionally, the processing module is further configured to:
基于所述初步像素尺寸,确定所述适配信息引导区的初步像素高度;Based on the initial pixel size, determine the initial pixel height of the adaptation information guidance area;
基于所述目标高度和所述基准信息引导区的展示状态信息,确定所述初步像素高度的高度调整值;Based on the target height and the display status information of the reference information guide area, the height adjustment value of the preliminary pixel height is determined;
基于所述高度调整值和所述初步像素高度,确定所述适配信息引导区的目标像素高度,并基于所述目标像素高度,确定所述适配信息引导区在所述适配应用界面中呈现的物理高度。Based on the height adjustment value and the preliminary pixel height, the target pixel height of the adaptation information guide area is determined, and based on the target pixel height, the physical height of the adaptation information guide area presented in the adaptation application interface is determined.
可选地,所述处理模块还用于:Optionally, the processing module is further configured to:
基于所述目标高度和所述基准信息引导区的展示状态信息,确定所述适配信息引导区的元素调整数量;Based on the target height and the display status information of the baseline information guide area, determine the number of elements to be adjusted in the adaptation information guide area;
基于所述元素调整数量和所述基准信息引导区在基准应用界面中展示的界面元素的基准数量,确定所述适配信息引导区在所述适配应用界面中展示的界面元素的目标数量。Based on the adjusted number of elements and the baseline number of interface elements displayed by the baseline information guide area in the baseline application interface, the target number of interface elements displayed by the adaptation information guide area in the adaptation application interface is determined.
可选地,所述适配应用界面还包括适配控件区,所述适配控件区用于展示与操作控件关联的界面元素,所述多个适配信息引导区中包括目标动态信息引导区;Optionally, the adapted application interface further includes an adapted control area, which is used to display interface elements associated with the operation controls, and the plurality of adapted information guidance areas include a target dynamic information guidance area;
所述适配控件区在所述适配应用界面中的目标展示位置,是基于所述目标动态信息引导区的下边界与所述适配应用界面的下边界之间的空白区域的像素尺寸确定的。The target display position of the adaptation control area in the adaptation application interface is determined based on the pixel size of the blank area between the lower boundary of the target dynamic information guide area and the lower boundary of the adaptation application interface.
可选地,所述处理模块还用于:Optionally, the processing module is further configured to:
若所述空白区域的像素尺寸大于预设阈值,则将所述空白区域作为所述适配控件区在所述适配应用界面中的目标展示位置;If the pixel size of the blank area is greater than a preset threshold, then the blank area will be used as the target display position of the adaptation control area in the adaptation application interface.
若所述空白区域的像素尺寸小于等于预设阈值,则基于基准动态信息引导区和基准控件区在所述基准应用界面中的展示位置关系,以及所述目标动态信息引导区在所述适配应用界面中的展示位置,确定所述适配控件区在所述适配应用界面中的目标展示位置。If the pixel size of the blank area is less than or equal to a preset threshold, the target display position of the adaptation control area in the adaptation application interface is determined based on the display position relationship between the benchmark dynamic information guide area and the benchmark control area in the benchmark application interface, and the display position of the target dynamic information guide area in the adaptation application interface.
可选地,所述目标应用包括多个独立的业务层级,所述多个独立的业务层级包括通知层、支线层、主线层、控件层和底图层。Optionally, the target application includes multiple independent business layers, including a notification layer, a branch layer, a main layer, a control layer, and a bottom layer.
可选地,所述多个适配信息引导区位于所述主线层;Optionally, the plurality of adaptation information guidance areas are located in the mainline layer;
每个所述适配信息引导区在所述适配应用界面中呈现的物理宽度,是在所述主线层中,根据所述适配信息引导区的初步像素尺寸和所述目标屏幕的目标宽度确定的;The physical width of each of the adaptation information guide areas presented in the adaptation application interface is determined in the main layer based on the initial pixel size of the adaptation information guide area and the target width of the target screen;
每个所述适配信息引导区在所述适配应用界面中呈现的物理高度,以及每个所述适配信息引导区展示的界面元素的目标数量,是在所述主线层中,根据所述适配信息引导区的初步像素尺寸以及所述目标屏幕的目标高度确定的。The physical height of each adaptation information guide area presented in the adaptation application interface, and the target number of interface elements displayed by each adaptation information guide area, are determined in the main layer based on the initial pixel size of the adaptation information guide area and the target height of the target screen.
可选地,所述适配控件区位于所述控件层;Optionally, the adaptation control area is located in the control layer;
所述适配控件区在所述适配应用界面中的目标展示位置,是在所述控件层中,基于所述目标动态信息引导区的下边界,与所述适配应用界面的下边界之间的空白区域的像素尺寸确定的。The target display position of the adaptation control area in the adaptation application interface is determined by the pixel size of the blank area between the lower boundary of the target dynamic information guide area and the lower boundary of the adaptation application interface in the control layer.
一方面,本申请实施例提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述应用界面适配的方法的步骤。On one hand, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the above-described application interface adaptation method.
一方面,本申请实施例提供了一种计算机可读存储介质,其存储有可由计算机设备执行的计算机程序,当所述程序在计算机设备上运行时,使得所述计算机设备执行上述图像处理方法的步骤。On one hand, embodiments of this application provide a computer-readable storage medium storing a computer program executable by a computer device, which, when run on the computer device, causes the computer device to perform the steps of the above-described image processing method.
一方面,本申请实施例提供了一种计算机程序产品,所述计算机程序产品包括存储在计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机设备执行时,使所述计算机设备执行上述应用界面适配的方法的步骤。On one hand, embodiments of this application provide a computer program product, the computer program product including a computer program stored on a computer-readable storage medium, the computer program including program instructions, which, when executed by a computer device, cause the computer device to perform the steps of the above-described application interface adaptation method.
本申请实施例中,以界面元素的基准虚拟像素尺寸与界面元素的目标虚拟像素尺寸相等为基准,结合界面元素的虚拟像素尺寸、像素尺寸、点密度三者之间的关系,确定适配应用界面中的界面元素的第一物理尺寸,以保证适配应用界面中的每个界面元素在适配应用界面中呈现的第一物理尺寸,与相应的界面元素在基准应用界面中相应呈现的第二物理尺寸相同,从而使得目标屏幕上展示的适配应用界面中的各个界面元素,与基准屏幕上展示的基准应用界面中相应的各个界面元素的视觉呈现效果相同,也保证了不同终端设备上呈现的适配应用界面中的界面元素的视觉呈现效果相同,进而提高对象的使用体验。其次,通过对目标屏幕进行标准化调整,使得一套基准应用界面,可以满足车载、平板和手机等不同屏幕的适配要求,避免了重复设计基准应用界面带来的资源浪费。另外在对应用界面中的信息引导区和控件区进行物理适配之后,进一步对信息引导区和控件区进行动态调整(包括左右适配和上下适配),同时,调整控件区在应用界面中的展示位置,增加了对细节的把控,更合理的利用了应用界面的空间。In this embodiment, the first physical size of the interface elements in the adapted application interface is determined by taking the equality of the baseline virtual pixel size and the target virtual pixel size of the interface elements as a benchmark, and combining the relationship between the virtual pixel size, pixel size, and dot density of the interface elements. This ensures that the first physical size of each interface element in the adapted application interface is the same as the second physical size of the corresponding interface element in the baseline application interface. This ensures that the visual presentation effect of each interface element in the adapted application interface displayed on the target screen is the same as that of the corresponding interface elements in the baseline application interface displayed on the baseline screen. It also ensures that the visual presentation effect of the interface elements in the adapted application interface displayed on different terminal devices is the same, thereby improving the user experience. Secondly, by standardizing the target screen, a single baseline application interface can meet the adaptation requirements of different screens such as automotive, tablet, and mobile phones, avoiding the waste of resources caused by repeatedly designing baseline application interfaces. In addition, after physically adapting the information guidance area and control area in the application interface, the information guidance area and control area are further dynamically adjusted (including left-right and top-bottom adaptation). At the same time, the display position of the control area in the application interface is adjusted, which increases the control over details and makes more reasonable use of the application interface space.
附图说明Attached Figure Description
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
图1为本申请实施例提供的一种系统架构示意图;Figure 1 is a schematic diagram of a system architecture provided in an embodiment of this application;
图2为本申请实施例提供的一种应用场景的示意图;Figure 2 is a schematic diagram of an application scenario provided by an embodiment of this application;
图3为本申请实施例提供的一种应用界面适配的方法的流程示意图;Figure 3 is a flowchart illustrating an application interface adaptation method provided in an embodiment of this application;
图4为本申请实施例提供的一种业务分层的示意图;Figure 4 is a schematic diagram of a service layering provided in an embodiment of this application;
图5为本申请实施例提供的一种基准应用界面和适配应用界面的示意图一;Figure 5 is a schematic diagram of a baseline application interface and an adapted application interface provided in an embodiment of this application;
图6为本申请实施例提供的一种基准应用界面和适配应用界面的示意图二;Figure 6 is a schematic diagram of a baseline application interface and an adapted application interface provided in an embodiment of this application;
图7为本申请实施例提供的一种功能区的示意图;Figure 7 is a schematic diagram of a functional area provided in an embodiment of this application;
图8为本申请实施例提供的一种基准应用界面和适配应用界面的示意图三;Figure 8 is a schematic diagram of a baseline application interface and an adapted application interface provided in an embodiment of this application;
图9为本申请实施例提供的一种基准应用界面和适配应用界面的示意图四;Figure 9 is a schematic diagram of a baseline application interface and an adapted application interface provided in an embodiment of this application;
图10为本申请实施例提供的一种基准应用界面和适配应用界面的示意图五;Figure 10 is a schematic diagram of a baseline application interface and an adapted application interface provided in an embodiment of this application;
图11为本申请实施例提供的一种基准应用界面和适配应用界面的示意图六;Figure 11 is a schematic diagram of a baseline application interface and an adapted application interface provided in an embodiment of this application;
图12为本申请实施例提供的一种应用界面适配的方法的流程示意图;Figure 12 is a flowchart illustrating an application interface adaptation method provided in an embodiment of this application;
图13为本申请实施例提供的一种应用界面适配的装置的结构示意图;Figure 13 is a schematic diagram of the structure of an application interface adaptation device provided in an embodiment of this application;
图14为本申请实施例提供的一种计算机设备的结构示意图。Figure 14 is a schematic diagram of the structure of a computer device provided in an embodiment of this application.
具体实施方式Detailed Implementation
为了使本发明的目的、技术方案及有益效果更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。To make the objectives, technical solutions, and beneficial effects of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
为了方便理解,下面对本发明实施例中涉及的名词进行解释。For ease of understanding, the terms used in the embodiments of this invention are explained below.
应用界面:也可以称之为使用者界面(User Interface,简称UI),是系统和用户之间进行交互和信息交换的媒介,目的在使得用户能够方便有效率地去操作硬件以达成双向之交互,完成所希望借助硬件完成之工作。Application Interface: Also known as User Interface (UI), it is the medium for interaction and information exchange between the system and the user. Its purpose is to enable users to operate the hardware conveniently and efficiently to achieve two-way interaction and complete the work they want to accomplish with the help of the hardware.
dpi:dot per inch,每英寸点数,也可以称之为点密度,是打印机、鼠标等设备分辨率的度量单位,也就是每英寸的像素。dpi的计算公式如以下公式(1)所示:dpi: dots per inch, also known as dot density, is a unit of measurement for the resolution of devices such as printers and mice, that is, pixels per inch. The formula for calculating dpi is shown in the following formula (1):
dpi=sqrt(X2+Y2)/C…………………(1)dpi=sqrt(X 2 +Y 2 )/C………………(1)
其中,X和Y分别表示屏幕分辨率中的宽度和高度,C表示屏幕对角线的长度,单位为英尺。Where X and Y represent the width and height in the screen resolution, respectively, and C represents the length of the screen diagonal, in feet.
ppi:point per pnch,每英尺内像素点个数,即像素密度。ppi: point per pnch, the number of pixels per foot, i.e., pixel density.
density:屏幕密度,density=屏幕dpi/160。density: screen density, density = screen dpi / 160.
dp:虚拟像素单位,1dp等于dpi为160的屏幕上的1个像素,等于dpi为320的屏幕上的2个像素,等于dpi为480的屏幕的上的3个像素。dp: Virtual pixel unit. 1 dp is equal to 1 pixel on a screen with a dpi of 160, 2 pixels on a screen with a dpi of 320, and 3 pixels on a screen with a dpi of 480.
一个界面元素的像素尺寸、虚拟像素尺寸以及屏幕的点密度之间的关系,如以下公式(2)所示:The relationship between the pixel size of an interface element, the virtual pixel size, and the pixel density of the screen is shown in the following formula (2):
p=d*(dpi/160)…………………(2)p=d*(dpi/160)………………(2)
其中,p表示界面元素的像素尺寸,单位为px;d表示界面元素的虚拟像素尺寸,单位为dp。Where p represents the pixel size of the interface element, in pixels (px); d represents the virtual pixel size of the interface element, in dp.
像素尺寸:采用占用的像素数量表征的尺寸。比如,应用界面中的某个界面元素在宽度方向上占用应用界面的3个像素,在高度方向上占用应用界面3个像素,则该界面元素的像素尺寸为3px*3px。Pixel size: Size represented by the number of pixels occupied. For example, if a UI element occupies 3 pixels in width and 3 pixels in height, then the pixel size of that UI element is 3px * 3px.
物理尺寸:用物理方法测出的尺寸,是一个可见的尺寸。比如,通过对屏幕上显示的某个界面元素进行物理测量,获得该界面元素的物理尺寸为:0.1英尺*0.1英尺。Physical size: A size measured using physical methods; it is a visible size. For example, by physically measuring a UI element displayed on a screen, the physical size of that UI element is obtained as 0.1 feet * 0.1 feet.
下面对本申请实施例的设计思想进行介绍。The design concept of the embodiments of this application will be introduced below.
相关技术中,一个应用程序的基准应用界面往往对应一个基准屏幕的基准分辨率,如,1280px*720px,而不同终端设备的待适配屏幕对应的目标分辨率可能是不同的;因此,为了与不同的终端设备适配,相关技术基于基准分辨率分别与不同目标分辨率之间的比例关系,相应调整基准应用界面中呈现的界面元素的物理尺寸,获得在不同终端设备上展示的适配应用界面。In related technologies, the baseline application interface of an application often corresponds to the baseline resolution of a baseline screen, such as 1280px*720px. However, the target resolution of the screen to be adapted for different terminal devices may be different. Therefore, in order to adapt to different terminal devices, related technologies adjust the physical size of the interface elements presented in the baseline application interface according to the proportional relationship between the baseline resolution and different target resolutions, so as to obtain the adapted application interface displayed on different terminal devices.
由于不同终端设备对应的目标分辨率是不同的,故不同目标分辨率与基准分辨率的比例关系也是不同的,因此,采用不同的比例关系,对同一基准应用界面中的界面元素进行物理尺寸调整获得的适配应用界面也是不同的,即在不同终端设备上呈现的适配应用界面中的界面元素的物理尺寸不同,进而影响应用程序界面的视觉呈现效果。Since different terminal devices have different target resolutions, the ratio between different target resolutions and the baseline resolution is also different. Therefore, by using different ratios to adjust the physical size of the interface elements in the same baseline application interface, the resulting adapted application interfaces will also be different. That is, the physical size of the interface elements in the adapted application interface presented on different terminal devices is different, which in turn affects the visual presentation effect of the application interface.
考虑到一个待适配屏幕往往对应目标分辨率和目标点密度两个属性。通过待适配屏幕展示适配应用界面时,适配应用界面中的界面元素的物理尺寸不仅与目标分辨率相关,同时与目标点密度相关。因此,需要结合目标分辨率与基准分辨率之间的关联关系,以及目标点密度与基准点密度之间的关联关系,对界面元素的物理尺寸进行调整,才能保证适配应用界面中呈现的界面元素的物理尺寸与基准应用界面中相应呈现的界面元素的物理尺寸相同,进而实现不同终端设备上呈现的适配应用界面中的界面元素的物理尺寸相同的效果。Considering that a screen to be adapted typically corresponds to two attributes—target resolution and target pixel density—the physical size of the interface elements in the adapted application interface is related not only to the target resolution but also to the target pixel density when displaying the adapted application interface on that screen. Therefore, it is necessary to adjust the physical size of the interface elements by combining the relationship between the target resolution and the baseline resolution, as well as the relationship between the target pixel density and the baseline pixel density. This ensures that the physical size of the interface elements presented in the adapted application interface is the same as the corresponding physical size of the interface elements presented in the baseline application interface, thereby achieving the effect of consistent physical size of interface elements in the adapted application interface across different terminal devices.
为了进一步简化对界面元素的物理尺寸进行调整的过程,本申请基于分辨率和点密度这两个参数,获得一个虚拟像素尺寸。然后针对每个界面元素,以界面元素的基准虚拟像素尺寸与界面元素的目标虚拟像素尺寸相等为基准,对基准应用界面的界面元素的物理尺寸进行调整,获得适配应用界面,以实现适配应用界面中呈现的界面元素的物理尺寸与基准应用界面中相应呈现的界面元素的物理尺寸相同。To further simplify the process of adjusting the physical size of interface elements, this application obtains a virtual pixel size based on the parameters of resolution and pixel density. Then, for each interface element, the physical size of the interface elements in the baseline application interface is adjusted based on the premise that the baseline virtual pixel size of the interface element is equal to the target virtual pixel size of the interface element, to obtain an adapted application interface, so that the physical size of the interface elements presented in the adapted application interface is the same as the physical size of the corresponding interface elements presented in the baseline application interface.
基于上述思路,本申请实施例提供了一种应用界面适配的方法,该方法包括:响应于针对目标应用的触发操作,通过目标屏幕展示目标应用的适配应用界面,其中,适配应用界面中包括多个界面元素,每个界面元素在适配应用界面中呈现的第一物理尺寸,与相应的界面元素在基准应用界面中相应呈现的第二物理尺寸相同;以及,每个第一物理尺寸,是基于界面元素在所配应用界面中的目标虚拟像素尺寸,以及目标屏幕的目标点密度确定的,目标虚拟像素尺寸与界面元素在基准应用界面中的基准虚拟像素尺寸相同。Based on the above ideas, this application provides a method for application interface adaptation. The method includes: in response to a trigger operation for a target application, displaying an adapted application interface of the target application on a target screen, wherein the adapted application interface includes multiple interface elements, and the first physical size of each interface element in the adapted application interface is the same as the second physical size of the corresponding interface element in the base application interface; and each first physical size is determined based on the target virtual pixel size of the interface element in the adapted application interface and the target point density of the target screen, wherein the target virtual pixel size is the same as the base virtual pixel size of the interface element in the base application interface.
本申请实施例中,以界面元素的基准虚拟像素尺寸与界面元素的目标虚拟像素尺寸相等为基准,结合界面元素的虚拟像素尺寸、像素尺寸、点密度三者之间的关系,确定适配应用界面中的界面元素的第一物理尺寸,以保证适配应用界面中的每个界面元素在适配应用界面中呈现的第一物理尺寸,与相应的界面元素在基准应用界面中相应呈现的第二物理尺寸相同,从而使得目标屏幕上展示的适配应用界面中的各个界面元素,与基准屏幕上展示的基准应用界面中相应的各个界面元素的视觉呈现效果相同,也保证了不同终端设备上呈现的适配应用界面中的界面元素的视觉呈现效果相同,进而提高对象的使用体验。In this embodiment, the first physical size of the interface elements in the adapted application interface is determined by taking the equality of the base virtual pixel size and the target virtual pixel size of the interface elements as a benchmark, and combining the relationship between the virtual pixel size, pixel size, and dot density of the interface elements. This ensures that the first physical size of each interface element in the adapted application interface is the same as the second physical size of the corresponding interface element in the base application interface. As a result, the visual presentation effect of each interface element in the adapted application interface displayed on the target screen is the same as that of the corresponding interface elements in the base application interface displayed on the base screen. This also ensures that the visual presentation effect of the interface elements in the adapted application interface displayed on different terminal devices is the same, thereby improving the user experience.
参考图1,其为本申请实施例适用的一种系统架构图,该系统架构至少包括终端设备101和服务器102,终端设备101的数量可以是一个或多个,服务器102的数量也可以是一个或多个,本申请对终端设备101和服务器102的数量不做具体限定。Referring to Figure 1, which is a system architecture diagram applicable to an embodiment of this application, the system architecture includes at least a terminal device 101 and a server 102. The number of terminal devices 101 can be one or more, and the number of servers 102 can also be one or more. This application does not specifically limit the number of terminal devices 101 and servers 102.
终端设备101中预先安装目标应用,其中,目标应用的类型可以是客户端应用、网页版应用、小程序应用等。目标应用具体可以是地图应用、车联网应用、即时通信应用、购物应用等。终端设备101可以是智能手机、平板电脑、笔记本电脑、台式计算机、智能家电、智能语音交互设备、智能车载设备等,但并不局限于此。The target application is pre-installed in the terminal device 101. The type of target application can be a client application, a web application, a mini-program application, etc. Specifically, the target application can be a map application, a vehicle-to-everything (V2X) application, an instant messaging application, a shopping application, etc. The terminal device 101 can be a smartphone, tablet, laptop, desktop computer, smart home appliance, smart voice interaction device, smart in-vehicle device, etc., but is not limited to these.
服务器102是目标应用的后台服务器,服务器102可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、内容分发网络(Content Delivery Network,CDN)、以及大数据和人工智能平台等基础云计算服务的云服务器。终端设备101与服务器102可以通过有线或无线通信方式进行直接或间接地连接,本申请在此不做限制。Server 102 is the backend server of the target application. Server 102 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. Terminal device 101 and server 102 can be connected directly or indirectly through wired or wireless communication, which is not limited herein.
本申请实施例中调整界面布局的方法可以是终端设备101执行,也可以是服务器102执行,还也可以由终端设备101与服务器102交互执行。The method for adjusting the interface layout in this embodiment can be executed by the terminal device 101, the server 102, or by the interaction between the terminal device 101 and the server 102.
以终端设备101执行本申请实施例中调整界面布局的方法举例来说,包括以下步骤:Taking the method of adjusting the interface layout in the embodiments of this application executed by terminal device 101 as an example, it includes the following steps:
终端设备101预先安装目标应用,终端设备101响应于针对目标应用的触发操作,通过目标屏幕展示目标应用的适配应用界面,其中,适配应用界面中包括多个界面元素,每个界面元素在适配应用界面中呈现的第一物理尺寸,与相应的界面元素在基准应用界面中相应呈现的第二物理尺寸相同;以及,每个第一物理尺寸,是基于界面元素在适配应用界面中的目标虚拟像素尺寸,以及目标屏幕的目标点密度确定的,目标虚拟像素尺寸与界面元素在基准应用界面中的基准虚拟像素尺寸相同。Terminal device 101 pre-installs a target application. In response to a trigger operation for the target application, terminal device 101 displays an adapted application interface of the target application on the target screen. The adapted application interface includes multiple interface elements. The first physical size of each interface element in the adapted application interface is the same as the second physical size of the corresponding interface element in the base application interface. Each first physical size is determined based on the target virtual pixel size of the interface element in the adapted application interface and the target pixel density of the target screen. The target virtual pixel size is the same as the base virtual pixel size of the interface element in the base application interface.
在实际应用中,本申请实施例中的调整界面布局的方法可以应用于地图应用、车联网应用、即时通信应用、购物应用等应用的界面布局调整。In practical applications, the method for adjusting the interface layout in this application embodiment can be applied to the interface layout adjustment of applications such as map applications, vehicle networking applications, instant messaging applications, and shopping applications.
以地图应用举例来说,如图2所示,在基准屏幕上展示基准应用界面,基准屏幕的基准分辨率为1280px*720px,基准屏幕的dpi=160。以界面元素201举例来说,界面元素201为文本“咖啡”,设定界面元素201在基准应用界面呈现的物理尺寸为5cm*2cm。Taking a map application as an example, as shown in Figure 2, the baseline application interface is displayed on a baseline screen. The baseline screen has a baseline resolution of 1280px * 720px and a dpi of 160. Taking interface element 201 as an example, interface element 201 is the text "coffee," and the physical size of interface element 201 displayed on the baseline application interface is set to 5cm * 2cm.
在第一待适配屏幕上展示第一适配应用界面,第一待适配屏幕的基准分辨率为1920px*720px,基准屏幕的dpi=160。此时,与界面元素201对应的界面元素202在第一适配应用界面中呈现的物理尺寸为5cm*2cm,即同一界面元素在分辨率不同,而dpi相同的两种屏幕上的视觉呈现效果相同。The first adapted application interface is displayed on the first screen to be adapted. The base resolution of the first screen to be adapted is 1920px * 720px, and the dpi of the base screen is 160. At this time, the physical size of the interface element 202 corresponding to the interface element 201 in the first adapted application interface is 5cm * 2cm, that is, the same interface element has the same visual presentation effect on two screens with different resolutions but the same dpi.
在第二待适配屏幕上展示第二适配应用界面,第二待适配屏幕的基准分辨率为1280px*720px,基准屏幕的dpi=240。此时,与界面元素201对应的界面元素203在第二适配应用界面中呈现的物理尺寸为5cm*2cm,即同一界面元素在分辨率相同,而dpi不同的两种屏幕上的视觉呈现效果相同。The second adapted application interface is displayed on the second screen to be adapted. The base resolution of the second screen to be adapted is 1280px*720px, and the dpi of the base screen is 240. At this time, the physical size of the interface element 203 corresponding to the interface element 201 in the second adapted application interface is 5cm*2cm, that is, the same interface element has the same visual presentation effect on two screens with the same resolution but different dpi.
需要说明的,在上述实施例场景描述中,仅以基准应用界面中的界面元素201进行举例说,其他界面元素的调整方式与界面元素201相同。另外,同一界面元素在分辨率和dpi均不同的两种屏幕上的视觉呈现效果也是相同的,此处不再赘述。It should be noted that in the above embodiment scenario description, only interface element 201 in the baseline application interface is used as an example; the adjustment methods for other interface elements are the same as those for interface element 201. Furthermore, the visual presentation effect of the same interface element is the same on two screens with different resolutions and dpi, which will not be elaborated further here.
基于图1所示的系统架构图,本申请实施例提供了一种调整界面布局的方法的流程,如图3所示,该方法的流程由计算机设备执行,该计算机设备可以是图1所示的终端设备101和/或服务器102,包括以下步骤:Based on the system architecture diagram shown in Figure 1, this application embodiment provides a flowchart of a method for adjusting the interface layout, as shown in Figure 3. The flowchart of this method is executed by a computer device, which may be the terminal device 101 and/or the server 102 shown in Figure 1, and includes the following steps:
步骤S301,获取目标应用。Step S301: Obtain the target application.
具体地,目标应用可以地图应用、车联网应用、即时通信应用、购物应用等。在一些实施例中,为个更好地承载业务,降低目标应用的页面耦合性,本申请实施例中,将目标应用拆分为多个业务层级,即目标应用包括多个独立的业务层级,多个独立的业务层级包括通知层、支线层、主线层、控件层和底图层,每个业务层级承载不同的业务功能,并预先设定各个业务层级之间的跳转逻辑和公共关系。Specifically, the target application can be a map application, a vehicle-to-everything (V2X) application, an instant messaging application, a shopping application, etc. In some embodiments, to better support business functions and reduce page coupling of the target application, the target application is split into multiple business layers in this application embodiment. That is, the target application includes multiple independent business layers, including a notification layer, a branch layer, a main layer, a control layer, and a bottom layer. Each business layer carries different business functions, and the jump logic and common relationships between each business layer are pre-defined.
在本申请实施例中,与不同业务相关的界面元素位于不同的业务层级,在对界面元素进行物理尺寸调整时,只需要对界面元素关联的业务层级进行调整即可,不需要对所有的业务层级进行调整,从而提高了界面元素调整的灵活性以及应用界面的耦合性。In this embodiment, interface elements related to different services are located at different service levels. When adjusting the physical size of the interface elements, only the service level associated with the interface element needs to be adjusted, and it is not necessary to adjust all service levels, thereby improving the flexibility of interface element adjustment and the coupling of the application interface.
以目标应用为地图应用举例来说,如图4所示,将地图应用划分为五个业务层级,从上到下依次为通知层401、支线层402、主线层403、控件层404和底图层405。Taking a map application as an example, as shown in Figure 4, the map application is divided into five business layers, from top to bottom: notification layer 401, branch layer 402, main layer 403, control layer 404, and bottom layer 405.
通知层401主要承载具有全局属性的通知和功能,悬浮则支线层之上,不影响其他业务层的布局。通知层401的表现形式是对话框、活动弹窗等。The notification layer 401 primarily carries notifications and functions with global attributes. It floats above the branch layer and does not affect the layout of other business layers. The notification layer 401 can be displayed as dialog boxes, pop-up windows, etc.
支线层402主要承载临时出现的支线任务。支线任务通常是单一任务流,有独立的操作页面,可以从任何场景唤起,支线任务完成后即退出当前支线页面。The branch layer 402 primarily handles temporary branch tasks. Branch tasks are typically single-task flows with independent operation pages, can be initiated from any scenario, and exit the current branch page upon completion of the branch task.
主线层403,也称为功能层或场景层,主线层承载不同业务场景下的功能。比如,导航场景下的导航功能,路径规划场景的路径规划功能等。The main layer (403), also known as the functional layer or scenario layer, carries functions for different business scenarios. For example, navigation functions in a navigation scenario, and path planning functions in a path planning scenario.
控件层404主要承载通过控件进行交互的功能。比如,在底图交互功能中,控件层提供底图全览、底图缩放等控件。在导航场景下,提供导航相关的控件。The 404 control layer primarily supports interactive functions via controls. For example, in the base map interaction function, the control layer provides controls for base map overview and zooming. In navigation scenarios, it provides navigation-related controls.
底图层405主要承载基础的地图信息和诱导信息,如路网、路况和导航路线等。The bottom layer 405 mainly carries basic map information and guidance information, such as road network, traffic conditions and navigation routes.
本申请实施例中,对目标应用进行业务分层,获得多个独立的业务层级,降低了业务耦合,故在对界面元素进行物理尺寸调整时,只需要对界面元素关联的业务层级进行调整即可,不需要对所有的业务层级进行调整,从而提高了界面元素调整的灵活性。其次,对目标应用进行业务分层提高了业务逻辑的清晰程序,促进技术层面上的基础组件的落地,降低技术层面的维护成本,从而达到降本增效的目标。In this embodiment, the target application is layered into multiple independent business layers, reducing business coupling. Therefore, when adjusting the physical size of interface elements, only the business layer associated with the interface element needs to be adjusted, rather than all business layers, thus improving the flexibility of interface element adjustment. Secondly, layering the target application into business layers improves the clarity of business logic, facilitates the implementation of basic technical components, and reduces technical maintenance costs, thereby achieving the goal of cost reduction and efficiency improvement.
步骤S302,响应于针对目标应用的触发操作,通过目标屏幕展示目标应用的适配应用界面,其中,适配应用界面中包括多个界面元素,每个界面元素在适配应用界面中呈现的第一物理尺寸,与相应的界面元素在基准应用界面中相应呈现的第二物理尺寸相同。Step S302: In response to a trigger operation for the target application, the adapted application interface of the target application is displayed on the target screen. The adapted application interface includes multiple interface elements, and the first physical size of each interface element in the adapted application interface is the same as the second physical size of the corresponding interface element in the base application interface.
具体地,触发操作可以是点击操作、双击操作、滑动操作等。目标屏幕为待适配屏幕,目标屏幕的目标分辨率可以与基准屏幕的基准分辨率相同,也可以与基准屏幕的基准分辨率不同。目标屏幕的目标点密度可以与基准屏幕的基准点密度相同,也可以与基准屏幕的基准点密度不同。Specifically, the triggering operation can be a click, double-click, swipe, etc. The target screen is the screen to be adapted to; its target resolution can be the same as or different from the baseline resolution of the reference screen. The target pixel density of the target screen can also be the same as or different from the baseline pixel density of the reference screen.
在一些实施例中,界面元素可以是文本、图像、视频等。每个所述第一物理尺寸,是基于界面元素在适配应用界面中的目标虚拟像素尺寸,以及目标屏幕的目标点密度确定的,目标虚拟像素尺寸与界面元素在基准应用界面中的基准虚拟像素尺寸相同,其中,界面元素的基准虚拟像素尺寸是将界面元素的像素尺寸和基准应用界面的基准点密度代入到上述公式(2)获得的。In some embodiments, the interface element may be text, image, video, etc. Each of the first physical dimensions is determined based on the target virtual pixel size of the interface element in the adapted application interface and the target point density of the target screen. The target virtual pixel size is the same as the reference virtual pixel size of the interface element in the reference application interface. The reference virtual pixel size of the interface element is obtained by substituting the pixel size of the interface element and the reference point density of the reference application interface into the above formula (2).
本申请实施例中,以界面元素的基准虚拟像素尺寸与界面元素的目标虚拟像素尺寸相等为基准,结合界面元素的虚拟像素尺寸、像素尺寸、点密度三者之间的关系,确定适配应用界面中的界面元素的第一物理尺寸,以保证适配应用界面中的每个界面元素在适配应用界面中呈现的第一物理尺寸,与相应的界面元素在基准应用界面中相应呈现的第二物理尺寸相同,从而使得目标屏幕上展示的适配应用界面中的各个界面元素,与基准屏幕上展示的基准应用界面中相应的各个界面元素的视觉呈现效果相同,也保证了不同终端设备上呈现的适配应用界面中的界面元素的视觉呈现效果相同,进而提高对象的使用体验。In this embodiment, the first physical size of the interface elements in the adapted application interface is determined by taking the equality of the base virtual pixel size and the target virtual pixel size of the interface elements as a benchmark, and combining the relationship between the virtual pixel size, pixel size, and dot density of the interface elements. This ensures that the first physical size of each interface element in the adapted application interface is the same as the second physical size of the corresponding interface element in the base application interface. As a result, the visual presentation effect of each interface element in the adapted application interface displayed on the target screen is the same as that of the corresponding interface elements in the base application interface displayed on the base screen. This also ensures that the visual presentation effect of the interface elements in the adapted application interface displayed on different terminal devices is the same, thereby improving the user experience.
可选地,在上述步骤S302中,每个界面元素在适配应用界面中呈现的第一物理尺寸,是采用以下方式确定的:Optionally, in step S302 above, the first physical size of each interface element presented in the adapted application interface is determined in the following way:
基于界面元素的目标虚拟像素尺寸和适配应用界面的目标点密度,确定界面元素在适配应用界面中对应的目标像素尺寸。再基于界面元素的目标像素尺寸,确定界面元素在适配应用界面中呈现的第一物理尺寸。Based on the target virtual pixel size of the interface element and the target point density of the adapted application interface, the target pixel size of the interface element in the adapted application interface is determined. Then, based on the target pixel size of the interface element, the first physical size of the interface element presented in the adapted application interface is determined.
具体地,虚拟像素也称之为设备无关像素。由于基准应用界面中的各个界面元素,是以虚拟像素为度量单位设计的,即界面元素在基准应用界面中的基准虚拟像素尺寸,决定了界面元素在基准应用界面中呈现的第二物理尺寸。Specifically, virtual pixels are also known as device-independent pixels. Since the various interface elements in the benchmark application interface are designed with virtual pixels as the unit of measurement, the benchmark virtual pixel size of the interface element in the benchmark application interface determines the second physical size of the interface element presented in the benchmark application interface.
为了保证界面元素在适配应用界面中呈现的第一物理尺寸,与在基准应用界面中相应呈现的第二物理尺寸相同,界面元素在适配应用界面中的目标虚拟像素尺寸,需要与界面元素在基准应用界面中的基准虚拟像素尺寸相同。将目标虚拟像素尺寸和目标屏幕的目标点密度,代入上述公式(2),可以获得界面元素在适配应用界面中对应的目标像素尺寸。之后再基于单位像素的物理尺寸以及界面元素的目标像素尺寸,可以获得界面元素在适配应用界面中呈现的第一物理尺寸。To ensure that the first physical size of the interface element presented in the adapted application interface is the same as the corresponding second physical size presented in the base application interface, the target virtual pixel size of the interface element in the adapted application interface needs to be the same as the base virtual pixel size of the interface element in the base application interface. Substituting the target virtual pixel size and the target pixel density of the target screen into the above formula (2), the target pixel size of the interface element in the adapted application interface can be obtained. Then, based on the physical size of the unit pixel and the target pixel size of the interface element, the first physical size of the interface element presented in the adapted application interface can be obtained.
举例来说,如图5所示,在基准屏幕上展示基准应用界面,基准屏幕的基准分辨率为1280px*720px,基准屏幕的dpi=160,单位像素的物理尺寸为1/160*1/160(单位为英尺)。此时,界面元素501为文本“范围”,界面元素501在基准应用界面中的基准虚拟像素尺寸为10dp*10dp,基准像素尺寸为10px*10px,则界面元素501在基准应用界面中呈现的第二物理尺寸为1/16*1/16(单位为英尺)。For example, as shown in Figure 5, a benchmark application interface is displayed on a benchmark screen. The benchmark screen has a benchmark resolution of 1280px * 720px, a benchmark screen dpi = 160, and a physical size of 1/160 * 1/160 (in feet) per pixel. In this case, interface element 501 is the text "Range". The benchmark virtual pixel size of interface element 501 in the benchmark application interface is 10dp * 10dp, and the benchmark pixel size is 10px * 10px. Therefore, the second physical size of interface element 501 presented in the benchmark application interface is 1/16 * 1/16 (in feet).
在目标屏幕上展示适配应用界面,目标屏幕的目标分辨率为1920px*720px,目标屏幕的dpi=160,单位像素的物理尺寸为1/160*1/160(单位为英尺)。此时,与界面元素501对应的界面元素502在适配应用界面中的目标虚拟像素尺寸与界面元素501的基准虚拟像素尺寸相同,即为10dp*10dp。将界面元素502的目标虚拟像素尺寸和目标屏幕的dpi代入上述公式(2),获得界面元素502的目标像素尺寸为10px*10px。Display the adapted application interface on the target screen. The target screen resolution is 1920px * 720px, the target screen dpi = 160, and the physical size of a unit pixel is 1/160 * 1/160 (in feet). At this time, the target virtual pixel size of the interface element 502 corresponding to the interface element 501 in the adapted application interface is the same as the base virtual pixel size of the interface element 501, which is 10dp * 10dp. Substituting the target virtual pixel size of the interface element 502 and the dpi of the target screen into the above formula (2), we obtain that the target pixel size of the interface element 502 is 10px * 10px.
基于单位像素的物理尺寸(1/160*1/160)以及目标像素尺寸(10px*10px),可以获得界面元素在适配应用界面中呈现的第一物理尺寸为1/16*1/16(单位为英尺),即界面元素501在适配应用界面中呈现的第一物理尺寸,与相应的界面元素502在基准应用界面中相应呈现的第二物理尺寸相同。Based on the physical size of the unit pixel (1/160*1/160) and the target pixel size (10px*10px), the first physical size of the interface element presented in the adapted application interface can be obtained as 1/16*1/16 (in feet). That is, the first physical size of the interface element 501 presented in the adapted application interface is the same as the second physical size of the corresponding interface element 502 presented in the base application interface.
举例来说,如图6所示,在基准屏幕上展示基准应用界面,基准屏幕的基准分辨率为1280px*720px,基准屏幕的dpi=160,单位像素的物理尺寸为1/160*1/160(单位为英尺)。此时,界面元素501为文本“范围”,界面元素501在基准应用界面中的基准虚拟像素尺寸为10dp*10dp,基准像素尺寸为10px*10px,则界面元素501在基准应用界面中呈现的第二物理尺寸为1/16*1/16(单位为英尺)。For example, as shown in Figure 6, a benchmark application interface is displayed on a benchmark screen. The benchmark screen has a benchmark resolution of 1280px * 720px, a benchmark screen dpi = 160, and a physical size of 1/160 * 1/160 (in feet) per pixel. At this time, interface element 501 is the text "Range". The benchmark virtual pixel size of interface element 501 in the benchmark application interface is 10dp * 10dp, and the benchmark pixel size is 10px * 10px. Therefore, the second physical size of interface element 501 presented in the benchmark application interface is 1/16 * 1/16 (in feet).
在目标屏幕上展示适配应用界面,目标屏幕的基准分辨率为1280px*720px,目标屏幕的dpi=320,每个像素的物理尺寸为1/320*1/320(单位为英尺)。此时,与界面元素501对应的界面元素503在适配应用界面中的目标虚拟像素尺寸与界面元素501的基准虚拟像素尺寸相同,即为10dp*10dp。将界面元素503的目标虚拟像素尺寸和目标屏幕的dpi代入上述公式(2),获得界面元素503在适配应用界面中的目标像素尺寸为20px*20px。The adapted application interface is displayed on the target screen. The base resolution of the target screen is 1280px*720px, the dpi of the target screen is 320, and the physical size of each pixel is 1/320*1/320 (in feet). At this time, the target virtual pixel size of the interface element 503 corresponding to the interface element 501 in the adapted application interface is the same as the base virtual pixel size of the interface element 501, which is 10dp*10dp. Substituting the target virtual pixel size of the interface element 503 and the dpi of the target screen into the above formula (2), the target pixel size of the interface element 503 in the adapted application interface is obtained as 20px*20px.
基于单位像素的物理尺寸(1/320*1/320)以及界面元素503的目标像素尺寸(20px*20px),可以获得界面元素在适配应用界面中呈现的第一物理尺寸为1/16*1/16(单位为英尺),即界面元素501在适配应用界面中呈现的第一物理尺寸,与相应的界面元素503在基准应用界面中相应呈现的第二物理尺寸相同。Based on the physical size of the unit pixel (1/320*1/320) and the target pixel size of the interface element 503 (20px*20px), the first physical size of the interface element presented in the adapted application interface can be obtained as 1/16*1/16 (in feet). That is, the first physical size of the interface element 501 presented in the adapted application interface is the same as the second physical size of the corresponding interface element 503 presented in the base application interface.
本申请实施例中,通过将界面元素的目标虚拟像素尺寸设置为界面元素在基准应用界面中对应的基准虚拟像素尺寸,以保证界面元素在适配应用界面中呈现的物理尺寸,与界面元素在基准应用界面中呈现的物理尺寸相同,然后基于界面元素的目标虚拟像素尺寸和目标屏幕的目标点密度,确定界面元素占用的像素数量,再基于像素数量以及单位像素的物理尺寸,确定界面元素在适配应用界面中呈现的第一物理尺寸,从而提高调整界面元素的物理尺寸的效率,也提高了界面元素的视觉呈现效果。In this embodiment, the target virtual pixel size of the interface element is set to the base virtual pixel size of the interface element in the base application interface to ensure that the physical size of the interface element presented in the adapted application interface is the same as that presented in the base application interface. Then, based on the target virtual pixel size of the interface element and the target point density of the target screen, the number of pixels occupied by the interface element is determined. Based on the number of pixels and the physical size of the unit pixel, the first physical size of the interface element presented in the adapted application interface is determined, thereby improving the efficiency of adjusting the physical size of the interface element and improving the visual presentation effect of the interface element.
可选地,在实际应用场景中,存在屏幕宽度范围截然不同的两类屏幕,一类是平板电脑屏幕、车载屏幕等大宽度屏幕,该类屏幕的屏幕宽度范围为600dp~1080dp。另一类是手机屏幕等小宽度屏幕,该类屏幕的屏幕宽度范围为300dp~500dp。在这两种屏幕宽度范围截然不同的两类屏幕下,若通过一个基准应用界面进行适配,将会导致在横向或者纵向出现内容超出范围的情况。而针对不同屏幕宽度范围的屏幕,分别设计不同的基准应用界面时,会造成资源浪费。Optionally, in practical applications, there are two types of screens with drastically different widths: one type is large-width screens such as tablet screens and automotive screens, with a width ranging from 600dp to 1080dp; the other type is small-width screens such as mobile phone screens, with a width ranging from 300dp to 500dp. If a single baseline application interface is used for adaptation on these two types of screens with drastically different widths, content may exceed the acceptable range in either the horizontal or vertical orientation. Designing different baseline application interfaces for different screen widths would result in wasted resources.
鉴于此,本申请实施例中,在针对目标屏幕进行应用界面适配之前,先对目标屏幕的原始点密度进行标准化处理,获得目标点密度,以保证基准应用界面能与目标屏幕适配,其中,具体采用以下方式确定目标屏幕的目标点密度:Therefore, in this embodiment of the application, before adapting the application interface to the target screen, the original pixel density of the target screen is first standardized to obtain the target pixel density, so as to ensure that the base application interface can be adapted to the target screen. Specifically, the target pixel density of the target screen is determined in the following way:
采用基于目标屏幕的目标分辨率和目标屏幕的原始屏幕密度,确定目标屏幕的有效宽度和有效高度。然后基于有效宽度与基准屏幕的基准宽度之间的第一差异度,以及有效高度与基准屏幕的基准高度之间的第二差异度,确定目标屏幕的标准化调整方向。基于标准化调整方向,对目标屏幕的原始像素密度进行调整,获得目标点密度。The effective width and effective height of the target screen are determined based on its target resolution and original screen density. Then, based on a first difference between the effective width and the reference width of the reference screen, and a second difference between the effective height and the reference height of the reference screen, the normalization adjustment direction of the target screen is determined. Based on this normalization adjustment direction, the original pixel density of the target screen is adjusted to obtain the target pixel density.
具体地,目标屏幕的目标分辨率包括目标屏幕的目标宽度和目标高度,其中,目标宽度表示目标屏幕在宽度方向上的像素数量,目标高度表示目标屏幕在高度方向上的像素数量。将目标屏幕的目标宽度与原始屏幕密度的比值,作为有效宽度,将目标屏幕的目标高度与原始屏幕密度的比值,作为有效高度。目标屏幕的有效宽度和有效高度组成了目标屏幕的目标虚拟像素尺寸。Specifically, the target resolution of the target screen includes the target width and target height. The target width represents the number of pixels in the width direction, and the target height represents the number of pixels in the height direction. The ratio of the target width to the original screen density is taken as the effective width, and the ratio of the target height to the original screen density is taken as the effective height. The effective width and effective height of the target screen constitute the target virtual pixel size of the target screen.
举例来说,设定目标屏幕的目标分辨率为1920px*720px,原始屏幕密度为1,则目标屏幕的目标宽度=1920px,目标屏幕的目标高度=720px,目标屏幕的有效宽度=1920dp,目标屏幕的有效高度=720dp。For example, if the target screen resolution is set to 1920px * 720px and the original screen density is 1, then the target screen width = 1920px, the target screen height = 720px, the effective screen width = 1920dp, and the effective screen height = 720dp.
本申请实施例中,通过对待适配屏幕进行标准化调整,使得不同宽度的屏幕均可以与一个基准应用界面适配,避免了重复设计基准应用界面带来的资源浪费,同时保证了不同待适配屏幕上展示的界面元素的物理尺寸的统一性,提高了界面元素的视觉呈现效果。In this embodiment, by standardizing the screens to be adapted, screens of different widths can be adapted to a single baseline application interface, avoiding the waste of resources caused by repeatedly designing the baseline application interface. At the same time, it ensures the uniformity of the physical size of the interface elements displayed on different screens to be adapted, and improves the visual presentation effect of the interface elements.
在一种可能的实施方式中,基于有效宽度与基准宽度的比值,确定第一差异度;以及基于有效高度与基准高度的比值,确定第二差异度。In one possible implementation, a first degree of difference is determined based on the ratio of the effective width to the reference width; and a second degree of difference is determined based on the ratio of the effective height to the reference height.
具体地,基准屏幕的基准分辨率包括基准屏幕的基准宽度和基准高度,其中,基准宽度表示基准屏幕在宽度方向上的像素数量,基准高度表示目标屏幕在高度方向上的像素数量。由于基准屏幕的基准屏幕密度默认为1,则基准屏幕的基准宽度与基准屏幕的有效宽度相同,基准屏幕的基准高度与基准屏幕的有效宽度相同。基准屏幕的有效宽度和有效高度组成了基准屏幕的基准虚拟像素尺寸。Specifically, the reference resolution of the reference screen includes its reference width and reference height. The reference width represents the number of pixels in the width direction of the reference screen, and the reference height represents the number of pixels in the height direction of the target screen. Since the reference screen density is 1 by default, the reference width and effective width of the reference screen are the same, and the reference height is also the same. The effective width and effective height of the reference screen constitute the reference virtual pixel size of the reference screen.
若第一差异度或第二差异度小于1,则说明目标屏幕无法直接与基准应用界面进行适配,需要预先对目标屏幕进行标准化调整,即采用基于第一差异度以及第二差异度,确定目标屏幕的标准化调整方向,并基于标准化调整方向,对目标屏幕的原始像素密度进行调整,获得目标点密度。If the first or second difference is less than 1, it means that the target screen cannot be directly adapted to the baseline application interface. The target screen needs to be standardized in advance. That is, based on the first and second difference, the standardization adjustment direction of the target screen is determined, and the original pixel density of the target screen is adjusted based on the standardization adjustment direction to obtain the target pixel density.
若第一差异度或第二差异度均大于1,则说明目标屏幕可以直接与基准应用界面进行适配,故不需要对目标屏幕进行标准化调整。If both the first and second differences are greater than 1, it means that the target screen can be directly adapted to the baseline application interface, so there is no need to standardize the target screen.
在基于第一差异度和第二差异度选择标准化调整方向时,本申请至少提供以下实施方式:When selecting the standardization adjustment direction based on the first degree of difference and the second degree of difference, this application provides at least the following implementation methods:
若第一差异度大于第二差异度,则将高度方向作为目标屏幕的标准化调整方向;若第一差异度小于等于第二差异度,则将宽度方向作为目标屏幕的标准化调整方向。If the first difference is greater than the second difference, the height direction is used as the standardization adjustment direction of the target screen; if the first difference is less than or equal to the second difference, the width direction is used as the standardization adjustment direction of the target screen.
本申请实施例中,基于目标屏幕的有效宽度与基准屏幕的基准宽度之间的大小,以及目标屏幕的有效高度与基准屏幕的基准高度之间的大小关系,确定目标屏幕是否能与基准应用界面进行适配,若不能,则从宽度方向和长度方向中选取差异程度更大的方向作为标准化调整方向,以保证在目标屏幕中展示适配应用界面时,横向或者纵向均不会出现内容超出范围的情况。In this embodiment, based on the relationship between the effective width of the target screen and the baseline width of the reference screen, and the relationship between the effective height of the target screen and the baseline height of the reference screen, it is determined whether the target screen can be adapted to the reference application interface. If not, the direction with the greater difference between the width and length directions is selected as the standardization adjustment direction to ensure that when the adapted application interface is displayed on the target screen, the content will not exceed the range in either the horizontal or vertical direction.
可选地,在基于标准化调整方向,对目标屏幕的原始像素密度进行调整,获得目标点密度时,本申请实施例至少提供以下实施方式:Optionally, when adjusting the original pixel density of the target screen based on the standardized adjustment direction to obtain the target pixel density, the embodiments of this application provide at least the following implementation methods:
基于目标分辨率,确定目标屏幕在标准化调整方向上对应的目标像素数量。然后基于目标像素数量,以及基准屏幕在标准化调整方向上对应的基准像素数量,对原始屏幕密度进行调整,获得目标屏幕密度。再基于目标屏幕密度以及基准点密度,对原始像素密度进行调整,确定目标点密度。Based on the target resolution, the number of target pixels corresponding to the target screen in the normalization adjustment direction is determined. Then, based on the number of target pixels and the number of reference pixels corresponding to the reference screen in the normalization adjustment direction, the original screen density is adjusted to obtain the target screen density. Finally, based on the target screen density and the reference pixel density, the original pixel density is adjusted to determine the target pixel density.
具体地,将目标像素数量与基准像素数量的比值,作为目标屏幕密度。然后将目标屏幕密度与基准点密度的乘积,作为目标点密度。Specifically, the ratio of the number of target pixels to the number of reference pixels is used as the target screen density. Then, the product of the target screen density and the reference pixel density is used as the target pixel density.
举例来说,设定基准屏幕的基准分辨率为1280px*720px,基准屏幕的dpi=160,基准屏幕的基准屏幕密度为1。目标屏幕的目标分辨率为3200px*1440px,目标屏幕的dpi=480,目标屏幕的原始屏幕密度为3。For example, the baseline resolution of the base screen is set to 1280px * 720px, the base screen dpi = 160, and the base screen density is 1. The target screen has a target resolution of 3200px * 1440px, a target screen dpi = 480, and a target screen density of 3.
计算目标屏幕的目标宽度与原始屏幕密度的比值,获得目标屏幕的有效宽度为1066dp;计算目标屏幕的目标高度与原始屏幕密度的比值,获得目标屏幕的有效高度为480dp。The ratio of the target screen width to the original screen density is calculated, and the effective width of the target screen is 1066dp; the ratio of the target screen height to the original screen density is calculated, and the effective height of the target screen is 480dp.
计算目标屏幕的有效宽度与基准屏幕的基准宽度的比值,获得第一差异度为0.833;计算目标屏幕的有效高度与基准屏幕的基准高度的比值,获得第二差异度为0.667。由于第一差异度和第二差异度均小于1,因此,需要对目标屏幕进行标准化调整。由于第一差异度大于第二差异度,则将高度方向作为标准化调整方向。The ratio of the effective width of the target screen to the reference width of the reference screen is calculated, yielding a first difference of 0.833; the ratio of the effective height of the target screen to the reference height of the reference screen is calculated, yielding a second difference of 0.667. Since both the first and second differences are less than 1, the target screen needs to be standardized. Because the first difference is greater than the second difference, the height direction is chosen as the standardization direction.
计算目标屏幕在高度方向上的目标像素数量,与基准屏幕在高度方向上的基准像素数量的比值,获得目标屏幕密度为2。然后计算目标屏幕密度与基准点密度的乘积,获得目标屏幕的目标点密度为320。此时,调整后的目标屏幕的有效宽度为1600dp,调整后的目标屏幕的有效高度为720dp。相应地,基于调整后的有效宽度和有效高度计算获得调整后的第一差异度和第二差异度后,此时,调整后的第一差异度和第二差异度均大于1,即此时的目标屏幕可以与基准应用界面进行适配,获得适配应用界面。The ratio of the number of target pixels in the height direction of the target screen to the number of reference pixels in the height direction of the reference screen is calculated, resulting in a target screen density of 2. Then, the product of the target screen density and the reference pixel density is calculated, resulting in a target pixel density of 320. At this point, the effective width of the adjusted target screen is 1600 dp, and the effective height is 720 dp. Correspondingly, based on the adjusted effective width and effective height, the first and second differences are calculated. Since both the first and second differences are greater than 1, the target screen can now be adapted to the reference application interface, thus obtaining an adapted application interface.
本申请实施例中,通过对待适配屏幕进行标准化调整,使得不同宽度的屏幕均可以与一个基准应用界面适配,避免了重复设计基准应用界面带来的资源浪费,同时保证了不同待适配屏幕上展示的界面元素的物理尺寸的统一性,提高了界面元素的视觉呈现效果。In this embodiment, by standardizing the screens to be adapted, screens of different widths can be adapted to a single baseline application interface, avoiding the waste of resources caused by repeatedly designing the baseline application interface. At the same time, it ensures the uniformity of the physical size of the interface elements displayed on different screens to be adapted, and improves the visual presentation effect of the interface elements.
可选地,适配应用界面还包括多个适配信息引导区,每个适配信息引导区用于展示与一类引导信息关联的界面元素。Optionally, the adapted application interface also includes multiple adaptation information guide areas, each of which displays interface elements associated with a type of guide information.
每个适配信息引导区在适配应用界面中呈现的物理宽度,是根据适配信息引导区的初步像素尺寸和目标屏幕的目标宽度确定的,其中,适配信息引导区的初步像素尺寸,是基于相应的基准信息引导区在基准应用界面中的基准虚拟像素尺寸,以及目标点密度确定的。The physical width of each adaptation information guide area presented in the adaptation application interface is determined based on the initial pixel size of the adaptation information guide area and the target width of the target screen. The initial pixel size of the adaptation information guide area is determined based on the baseline virtual pixel size of the corresponding baseline information guide area in the baseline application interface and the target point density.
每个适配信息引导区各自在适配应用界面中呈现的物理高度,以及多个适配信息引导区各自展示的界面元素的目标数量,是根据适配信息引导区的初步像素尺寸以及目标屏幕的目标高度确定的。The physical height of each adaptation guide area within the adapted application interface, as well as the target number of interface elements displayed by each of the multiple adaptation guide areas, are determined based on the initial pixel size of the adaptation guide area and the target height of the target screen.
具体地,应用界面可以根据功能模块预先划分为多个功能区,其中,功能区指应用界面中承载界面元素的信息容器,多个功能区包括控件区和多个信息引导区,多个信息引导区包括动态信息引导区、底图引导区等。多个功能区在应用界面的位置可以根据实际情况进行设置。Specifically, the application interface can be pre-divided into multiple functional areas based on functional modules. Each functional area refers to an information container within the application interface that holds interface elements. These multiple functional areas include control areas and multiple information guidance areas, such as dynamic information guidance areas and background image guidance areas. The positions of these functional areas within the application interface can be set according to the actual situation.
举例来说,如图7所示,应用界面中包括动态信息引导区701、底图引导区702和控件区703。For example, as shown in Figure 7, the application interface includes a dynamic information guide area 701, a background image guide area 702, and a control area 703.
在对基准应用界面中的界面元素进行调整,获得适配应用界面中的界面元素的过程中,采用相同的方式对基准应用界面中的各个基准功能区进行调整,获得适配应用界面中的对应初步像素尺寸的各个适配功能区,适配功能区包括适配信息引导区、适配控件区等。其中,基于基准功能区的基准虚拟像素尺寸,以及目标屏幕的目标点密度,确定适配功能区的初步像素尺寸。之后再分别对适配功能区的初步像素尺寸进行动态调整,获得适配应用界面中最终的适配功能区。In the process of adjusting the interface elements in the benchmark application interface to obtain the interface elements in the adaptable application interface, the same method is used to adjust each benchmark functional area in the benchmark application interface to obtain each adaptable functional area in the adaptable application interface with a corresponding initial pixel size. The adaptable functional areas include the adaptation information guidance area, the adaptation control area, etc. Specifically, the initial pixel size of the adaptable functional area is determined based on the benchmark virtual pixel size of the benchmark functional area and the target point density of the target screen. Then, the initial pixel size of each adaptable functional area is dynamically adjusted to obtain the final adaptable functional areas in the adaptable application interface.
需要说明的是,基于基准功能区的基准虚拟像素尺寸,以及目标屏幕的目标点密度,确定适配功能区的初步像素尺寸的过程,与基于界面元素在基准应用界面中的基准虚拟像素尺寸,以及目标屏幕的目标点密度,确定界面元素的目标像素尺寸的方法相同,此处不再赘述。在对适配功能区的初步像素尺寸进行动态调整时,仅仅调整适配功能区这一信息容器的像素尺寸,并不会调整适配功能区中的界面元素的像素尺寸,因此,适配功能区的物理尺寸与相应的基准功能区的物理尺寸可能是不相同的,但是适配功能区中的界面元素的物理尺寸,与相应的基准功能区中的界面元素的物理尺寸始终是相同的。It should be noted that the process of determining the initial pixel size of the adaptation function area based on the baseline virtual pixel size of the baseline function area and the target point density of the target screen is the same as the method of determining the target pixel size of the interface elements based on the baseline virtual pixel size of the interface elements in the baseline application interface and the target point density of the target screen, and will not be repeated here. When dynamically adjusting the initial pixel size of the adaptation function area, only the pixel size of the adaptation function area as an information container is adjusted, and the pixel size of the interface elements in the adaptation function area is not adjusted. Therefore, the physical size of the adaptation function area may be different from the physical size of the corresponding baseline function area, but the physical size of the interface elements in the adaptation function area is always the same as the physical size of the interface elements in the corresponding baseline function area.
本申请实施例中,在对基准应用界面中的界面元素进行调整,获得适配应用界面中的界面元素的过程中,相应对基准应用界面中的基准信息引导区进行调整,获得适配应用界面中初步的适配信息引导区,之后再对初步的适配信息引导区进行动态调整,使得适配信息引导区与适配应用界面更加匹配,从而提升视觉呈现效果。In this embodiment, during the process of adjusting the interface elements in the baseline application interface to obtain the interface elements in the adapted application interface, the baseline information guidance area in the baseline application interface is adjusted accordingly to obtain the preliminary adaptation information guidance area in the adapted application interface. Then, the preliminary adaptation information guidance area is dynamically adjusted to make the adaptation information guidance area more compatible with the adapted application interface, thereby improving the visual presentation effect.
在一些实施例中,每个适配信息引导区在适配应用界面中呈现的物理宽度,是采用以下方式确定的:In some embodiments, the physical width of each adaptation information guide area presented in the adaptation application interface is determined in the following manner:
基于基准宽度范围和基准屏幕的基准点密度,确定适配信息引导区的目标宽度调整范围。基于初步像素尺寸,确定适配信息引导区的初步像素宽度。然后基于目标屏幕的目标宽度以及宽度调整范围,对初步像素宽度进行调整,获得适配信息引导区的目标像素宽度,并基于目标像素宽度,确定适配信息引导区在适配应用界面中呈现的物理宽度。Based on the baseline width range and the baseline pixel density of the baseline screen, the target width adjustment range of the adaptation information guide area is determined. Based on the initial pixel size, the initial pixel width of the adaptation information guide area is determined. Then, based on the target width of the target screen and the width adjustment range, the initial pixel width is adjusted to obtain the target pixel width of the adaptation information guide area. Based on the target pixel width, the physical width of the adaptation information guide area presented in the adapted application interface is determined.
具体地,设置一个基准宽度范围,该基准宽度范围对应一个预设点密度,比如(预设dpi=160)。然后将基准宽度范围对应的预设点密度和基准屏幕的基准点密度的比值,作为基准宽度调整范围的调整比例;再将基准宽度调整范围的上下边界值,分别与调整比例相乘,获得适配信息引导区的目标宽度调整范围。Specifically, a baseline width range is set, which corresponds to a preset pixel density, for example (preset dpi = 160). Then, the ratio of the preset pixel density corresponding to the baseline width range to the baseline pixel density of the baseline screen is used as the adjustment ratio of the baseline width adjustment range. Then, the upper and lower boundary values of the baseline width adjustment range are multiplied by the adjustment ratio respectively to obtain the target width adjustment range of the adaptation information guidance area.
基于目标屏幕的目标宽度,按照预设选取规则,从目标宽度调整范围中选取一个宽度值,作为该适配信息引导区在适配应用界面中的目标像素宽度;再将目标像素宽度与单位像素的物理尺寸相乘,获得该适配信息引导区在适配应用界面中呈现的物理宽度,其中,目标屏幕的目标宽度越小,适配信息引导区在适配应用界面中呈现的物理宽度越小;目标屏幕的目标宽度越大,适配信息引导区在适配应用界面中呈现的物理宽度越大。Based on the target width of the target screen, a width value is selected from the target width adjustment range according to preset selection rules, and this value is used as the target pixel width of the adaptation information guide area in the adaptation application interface. Then, the target pixel width is multiplied by the physical size of the unit pixel to obtain the physical width of the adaptation information guide area in the adaptation application interface. The smaller the target width of the target screen, the smaller the physical width of the adaptation information guide area in the adaptation application interface; the larger the target width of the target screen, the larger the physical width of the adaptation information guide area in the adaptation application interface.
举例来说,如图8所示,设定基准屏幕的基准分辨率为1920px*720px,基准屏幕的基准点密度为160,基准宽度调整范围为480px~560px,基准宽度范围对应的预设点密度为160。For example, as shown in Figure 8, the baseline resolution of the baseline screen is set to 1920px*720px, the baseline pixel density of the baseline screen is 160, the baseline width adjustment range is 480px~560px, and the preset pixel density corresponding to the baseline width range is 160.
由于基准屏幕的基准点密度与基准宽度范围对应的预设点密度相同,则基准宽度调整范围的调整比例为1,基于调整比例可以相应获得目标宽度调整范围为480px~560px,基准信息引导区801的像素宽度为560px。Since the reference point density of the reference screen is the same as the preset point density corresponding to the reference width range, the adjustment ratio of the reference width adjustment range is 1. Based on the adjustment ratio, the target width adjustment range can be obtained as 480px to 560px, and the pixel width of the reference information guide area 801 is 560px.
预设选取规则如下:The default selection rules are as follows:
当屏幕宽度小于1440px时,适配信息引导区在适配应用界面中的目标像素宽度为目标宽度调整范围的最小宽度MinN2。When the screen width is less than 1440px, the target pixel width of the adaptation information guide area in the adaptation application interface is the minimum width MinN2 of the target width adjustment range.
当屏幕宽度大于等于1440px,且小于1660px时,适配信息引导区在适配应用界面中的目标像素宽度为目标宽度调整范围的最小宽度MinN2与最大宽度MaxN2的平均值。When the screen width is greater than or equal to 1440px and less than 1660px, the target pixel width of the adaptation information guide area in the adaptation application interface is the average of the minimum width MinN2 and the maximum width MaxN2 of the target width adjustment range.
当屏幕宽度大于等于1660px时,适配信息引导区在适配应用界面中的目标像素宽度为目标宽度调整范围的最大宽度MaxN2。When the screen width is greater than or equal to 1660px, the target pixel width of the adaptation information guide area in the adaptation application interface is the maximum width of the target width adjustment range, MaxN2.
设定目标屏幕的目标分辨率为1560px*720px,目标屏幕的目标点密度为160。由于目标屏幕的目标点密度与基准屏幕的基准点密度相同,因此适配信息引导区的初步像素尺寸,与基准信息引导区的基准像素尺寸相同。The target screen resolution is set to 1560px * 720px, and the target pixel density is set to 160. Since the target pixel density of the target screen is the same as the reference pixel density of the base screen, the initial pixel size of the adaptation information guidance area is the same as the reference pixel size of the base information guidance area.
由于目标屏幕的目标宽度为1560px,根据上述选取规则可以确定适配信息引导区802在适配应用界面中的目标像素宽度为520px,则将适配信息引导区802的初步像素宽度560px调整为目标像素宽度520px,最后将目标像素宽度与单位像素的物理宽度相乘,获得该适配信息引导区在适配应用界面中呈现的物理宽度。Since the target width of the target screen is 1560px, according to the above selection rules, the target pixel width of the adaptation information guide area 802 in the adaptation application interface can be determined to be 520px. Therefore, the initial pixel width of the adaptation information guide area 802 of 560px is adjusted to the target pixel width of 520px. Finally, the target pixel width is multiplied by the physical width of the unit pixel to obtain the physical width of the adaptation information guide area in the adaptation application interface.
举例来说,如图9所示,设定基准屏幕的基准分辨率为1920px*720px,基准屏幕的基准点密度为200,基准宽度调整范围为480px~560px,基准宽度范围对应的预设点密度为160。For example, as shown in Figure 9, the baseline resolution of the baseline screen is set to 1920px*720px, the baseline pixel density of the baseline screen is 200, the baseline width adjustment range is 480px~560px, and the preset pixel density corresponding to the baseline width range is 160.
由于基准屏幕的基准点密度与基准宽度范围对应的预设点密度的比值为1.25,则基准宽度调整范围的调整比例为1.25,基于调整比例可以相应获得目标宽度调整范围为600px~700px,基准信息引导区901的像素宽度为700px。Since the ratio of the reference point density of the reference screen to the preset point density corresponding to the reference width range is 1.25, the adjustment ratio of the reference width adjustment range is 1.25. Based on the adjustment ratio, the target width adjustment range can be obtained as 600px to 700px, and the pixel width of the reference information guide area 901 is 700px.
预设选取规则如下:The default selection rules are as follows:
当屏幕宽度小于1440px时,适配信息引导区在适配应用界面中的目标像素宽度为目标宽度调整范围的最小宽度MinN。When the screen width is less than 1440px, the target pixel width of the adaptation information guide area in the adaptation application interface is the minimum width MinN of the target width adjustment range.
当屏幕宽度大于等于1440px,且小于1660px时,适配信息引导区在适配应用界面中的目标像素宽度为目标宽度调整范围的最小宽度MinN与最大宽度MaxN的平均值。When the screen width is greater than or equal to 1440px and less than 1660px, the target pixel width of the adaptation information guide area in the adaptation application interface is the average of the minimum width MinN and the maximum width MaxN of the target width adjustment range.
当屏幕宽度大于等于1660px时,适配信息引导区在适配应用界面中的目标像素宽度为目标宽度调整范围的最大宽度MaxN。When the screen width is greater than or equal to 1660px, the target pixel width of the adaptation information guide area in the adaptation application interface is the maximum width MaxN of the target width adjustment range.
设定目标屏幕的目标分辨率为1560px*720px,目标屏幕的dpi=200,由于目标屏幕的目标点密度与基准屏幕的基准点密度相同,因此适配信息引导区的初步像素尺寸,与基准信息引导区的基准像素尺寸相同。The target screen resolution is set to 1560px*720px, and the target screen dpi = 200. Since the target pixel density of the target screen is the same as the reference pixel density of the reference screen, the initial pixel size of the adaptation information guidance area is the same as the reference pixel size of the reference information guidance area.
由于目标屏幕的目标宽度1560px,根据上述选取规则可以确定适配信息引导区902在适配应用界面中的目标像素宽度为650px,则将适配信息引导区902的初步像素宽度700px调整为目标像素宽度650px,最后将目标像素宽度与单位像素的物理宽度相乘,获得该适配信息引导区在适配应用界面中呈现的物理宽度。Since the target screen width is 1560px, according to the above selection rules, the target pixel width of the adaptation information guide area 902 in the adaptation application interface can be determined to be 650px. Therefore, the initial pixel width of the adaptation information guide area 902 of 700px is adjusted to the target pixel width of 650px. Finally, the target pixel width is multiplied by the physical width of the unit pixel to obtain the physical width of the adaptation information guide area in the adaptation application interface.
本申请实施例中,基于基准屏幕的基准宽度以及目标屏幕的目标宽度之间的关联关系,对适配应用界面中呈现的适配信息引导区域进行左右宽度适配,使得适配信息引导区的尺寸与适配应用界面更加匹配,从而提升适配应用界面的视觉呈现效果。In this embodiment, based on the correlation between the baseline width of the reference screen and the target width of the target screen, the left and right widths of the adaptation information guidance area presented in the adaptation application interface are adapted, so that the size of the adaptation information guidance area matches the adaptation application interface better, thereby improving the visual presentation effect of the adaptation application interface.
在一些实施例中,上述多个适配信息引导区位于目标应用的各个业务层级中的主线层;每个适配信息引导区在适配应用界面中呈现的物理宽度,是在主线层中,根据适配信息引导区的初步像素尺寸和目标屏幕的目标宽度确定的。In some embodiments, the aforementioned multiple adaptation information guide areas are located in the mainline layer of each business layer of the target application; the physical width of each adaptation information guide area presented in the adaptation application interface is determined in the mainline layer based on the initial pixel size of the adaptation information guide area and the target width of the target screen.
每个适配信息引导区在适配应用界面中呈现的物理高度,以及每个适配信息引导区展示的界面元素的目标数量,是在主线层中,根据适配信息引导区的初步像素尺寸以及目标屏幕的目标高度确定的。The physical height of each adaptation guide area in the adapted application interface, as well as the target number of interface elements displayed in each adaptation guide area, are determined in the main layer based on the initial pixel size of the adaptation guide area and the target height of the target screen.
在一些实施例中,每个适配信息引导区在适配应用界面中呈现的物理高度,是采用以下方式确定的:In some embodiments, the physical height of each adaptation information guide area presented in the adaptation application interface is determined in the following way:
基于初步像素尺寸,确定适配信息引导区的初步像素高度。然后基于目标屏幕的目标高度和基准信息引导区的展示状态信息,确定初步像素高度的高度调整值。基于高度调整值和初步像素高度,确定适配信息引导区的目标像素高度,并基于目标像素高度,确定适配信息引导区在适配应用界面中呈现的物理高度。Based on the initial pixel dimensions, the initial pixel height of the adaptation information guide area is determined. Then, based on the target height of the target screen and the display status information of the baseline information guide area, the height adjustment value of the initial pixel height is determined. Based on the height adjustment value and the initial pixel height, the target pixel height of the adaptation information guide area is determined, and based on the target pixel height, the physical height of the adaptation information guide area presented in the adapted application interface is determined.
在一些实施例中,每个适配信息引导区展示的界面元素的目标数量,是采用以下方式确定的:In some embodiments, the target number of interface elements displayed in each adaptation information guide area is determined in the following manner:
基于目标高度和基准信息引导区的展示状态信息,确定适配信息引导区的元素调整数量。然后基于元素调整数量和基准信息引导区在基准应用界面中展示的界面元素的基准数量,确定适配信息引导区在适配应用界面中展示的界面元素的目标数量。Based on the target height and the display status information of the baseline information guide area, the number of elements to be adjusted in the adaptation information guide area is determined. Then, based on the number of elements adjusted and the baseline number of interface elements displayed in the baseline application interface by the baseline information guide area, the target number of interface elements displayed in the adaptation application interface by the adaptation information guide area is determined.
具体地,若基准信息引导区的展示状态信息表征基准信息引导区没有展示全部的界面元素,则相应的适配信息引导区可以通过增大展示区域来展示更多的界面元素。Specifically, if the display status information of the baseline information guide area indicates that the baseline information guide area has not displayed all interface elements, the corresponding adaptation information guide area can display more interface elements by increasing the display area.
具体实施中,当适配应用界面的目标高度,可以展示初步像素高度的适配信息引导区,且还存在额外可用于展示适配信息引导区的空白区域,则基于空白区域的像素高度,确定初步像素高度的高度调整值以及适配信息引导区的元素调整数量,此时,高度调整值和元素调整数量均大于0。In practice, when the target height of the application interface can be adapted to display the adaptation information guide area with the initial pixel height, and there is also an additional blank area that can be used to display the adaptation information guide area, the height adjustment value of the initial pixel height and the number of elements to be adjusted in the adaptation information guide area are determined based on the pixel height of the blank area. At this time, both the height adjustment value and the number of elements to be adjusted are greater than 0.
当适配应用界面的目标高度,可以展示初步像素高度的适配信息引导区,且不存在额外可用于展示适配信息引导区的空白区域,则初步像素高度的高度调整值以及适配信息引导区的元素调整数量均为0。When the target height of the application interface can be adapted to display the adaptation information guide area with the initial pixel height, and there is no additional blank area that can be used to display the adaptation information guide area, then the height adjustment value of the initial pixel height and the number of elements adjusted in the adaptation information guide area are both 0.
当适配应用界面的目标高度,无法展示全部的初步像素高度的适配信息引导区时,基于适配信息引导区中无法展示的像素高度,确定初步像素高度的高度调整值以及适配信息引导区的元素调整数量,此时,高度调整值和元素调整数量均小于0。When the target height of the application interface cannot be adapted to display the entire initial pixel height of the adaptation information guide area, the height adjustment value of the initial pixel height and the number of elements to be adjusted in the adaptation information guide area are determined based on the pixel height that cannot be displayed in the adaptation information guide area. At this time, both the height adjustment value and the number of elements to be adjusted are less than 0.
若基准信息引导区的展示状态表征基准信息引导区已经展示全部的界面元素,则初步像素高度的高度调整值以及适配信息引导区的元素调整数量均为0。If the display status of the baseline information guide area indicates that all interface elements have been displayed, then the initial pixel height adjustment value and the number of elements adjusted to adapt to the information guide area are both 0.
将高度调整值与适配信息引导区的初步像素高度相加,确定该适配信息引导区在适配应用界面中的目标像素高度,之后再将适配信息引导区的目标像素高度与单位像素的物理高度相乘,获得适配信息引导区的呈现的物理高度。将元素调整数量和基准信息引导区在基准应用界面中展示的界面元素的基准数量相加,确定该信息引导区在适配应用界面中展示的界面元素的目标数量。Add the height adjustment value to the initial pixel height of the adaptation information guide area to determine the target pixel height of the adaptation information guide area in the adapted application interface. Then, multiply the target pixel height of the adaptation information guide area by the physical height of the unit pixel to obtain the physical height of the displayed adaptation information guide area. Add the element adjustment quantity to the baseline number of interface elements displayed by the baseline information guide area in the baseline application interface to determine the target number of interface elements displayed by the information guide area in the adapted application interface.
举例来说,如图10所示,设定基准屏幕的基准分辨率为1920px*720px,基准屏幕的dpi=160,基准信息引导区1001的像素高度为400px,基准信息引导区1001中界面元素的基准数量为4个。For example, as shown in Figure 10, the baseline resolution of the baseline screen is set to 1920px*720px, the dpi of the baseline screen is 160, the pixel height of the baseline information guide area 1001 is 400px, and the baseline number of interface elements in the baseline information guide area 1001 is 4.
设定目标屏幕的目标分辨率为1920px*1080px,目标屏幕的dpi=160,由于目标点密度与基准点密度相同,则适配信息引导区1002的初步像素高度与基准信息引导区1001的基准像素高度相同。The target screen resolution is set to 1920px*1080px, and the target screen dpi=160. Since the target point density is the same as the reference point density, the initial pixel height of the adaptation information guide area 1002 is the same as the reference pixel height of the reference information guide area 1001.
设定基准信息引导区1001的展示状态信息,表征基准信息引导区1001没有展示全部的界面元素,且适配应用界面的目标高度,可以展示初步像素高度的适配信息引导区1002,且还存在额外可用于展示适配信息引导区的空白区域,则基于空白区域的像素高度,确定初步像素高度的高度调整值300px以及适配信息引导区的元素调整数量为3个。The display status information of the baseline information guide area 1001 is set to indicate that the baseline information guide area 1001 does not display all interface elements and adapts to the target height of the application interface. It can display the adaptation information guide area 1002 with a preliminary pixel height and there is also an additional blank area that can be used to display the adaptation information guide area. Based on the pixel height of the blank area, the height adjustment value of the preliminary pixel height is determined to be 300px and the number of elements in the adaptation information guide area is adjusted to 3.
将高度调整值与适配信息引导区1002的初步像素高度相加,确定该适配信息引导区1002在适配应用界面中的目标像素高度700px,之后再将目标像素高度与单位像素的物理高度相乘,获得适配信息引导区1002的呈现的物理高度。将元素调整数量和基准信息引导区1001在基准应用界面中展示的界面元素的基准数量相加,确定适配信息引导区1002在适配应用界面中展示的界面元素的目标数量为7个。在进行上下适配并显示适配信息引导区1002时,高度方向上界面元素之间的间距不发生变化,信息容器会随高度发生变化,增加显示的内容。The height adjustment value is added to the initial pixel height of the adaptation information guide area 1002 to determine the target pixel height of 700px in the adapted application interface. Then, the target pixel height is multiplied by the physical height per unit pixel to obtain the physical height of the adapted information guide area 1002. The number of elements adjusted is added to the baseline number of interface elements displayed in the baseline application interface of the baseline information guide area 1001 to determine the target number of interface elements displayed in the adapted application interface of 7. When performing vertical adaptation and displaying the adapted information guide area 1002, the spacing between interface elements in the height direction remains unchanged, while the information container changes with the height, increasing the displayed content.
本申请实施例中,基于目标屏幕的目标高度以及基准信息引导区中的展示状态信息,对适配应用界面中呈现的适配信息引导区进行上下高度适配,使得适配信息引导区中展示的界面元素的数量可以根据目标屏幕的目标高度相应调整,从而使适配应用界面的空间可以得到充分利用,既避免了空间浪费,又保证了应用界面的视觉呈现效果。In this embodiment, based on the target height of the target screen and the display status information in the reference information guide area, the vertical height of the adaptation information guide area presented in the adaptation application interface is adapted, so that the number of interface elements displayed in the adaptation information guide area can be adjusted accordingly according to the target height of the target screen, thereby making full use of the space of the adaptation application interface, avoiding space waste and ensuring the visual presentation effect of the application interface.
可选地,适配应用界面还包括适配控件区,适配控件区用于展示与操作控件关联的界面元素,多个适配信息引导区中包括目标动态信息引导区。适配控件区在适配应用界面中的目标展示位置,是基于目标动态信息引导区的下边界与适配应用界面的下边界之间的空白区域的像素尺寸确定的。Optionally, the adapted application interface also includes an adapted control area, which is used to display interface elements associated with the operation controls. This adapted control area includes a target dynamic information guide area among multiple adapted information guide areas. The target display position of the adapted control area within the adapted application interface is determined based on the pixel dimensions of the blank area between the lower boundary of the target dynamic information guide area and the lower boundary of the adapted application interface.
具体地,基于基准控件区的基准虚拟像素尺寸,以及目标屏幕的目标点密度,确定适配控件区的初步像素尺寸。可以直接将适配控件区的初步像素尺寸直接作为适配控件区的目标像素尺寸进行展示,也可以采用确定上述适配信息引导区的目标像素尺寸相同的方式,确定适配控件区的目标像素尺寸。基于适配控件区的初步像素尺寸以及单位像素的物理尺寸,确定适配控件区在适配应用界面中呈现的物理尺寸。Specifically, based on the baseline virtual pixel size of the baseline control area and the target pixel density of the target screen, the initial pixel size of the adaptation control area is determined. This initial pixel size can be directly used as the target pixel size for display, or the target pixel size of the adaptation control area can be determined by using the same method as the target pixel size of the aforementioned adaptation information guide area. Based on the initial pixel size of the adaptation control area and the physical size of a unit pixel, the physical size of the adaptation control area presented in the adapted application interface is determined.
在一些实施例中,适配控件区位于目标应用的各个业务层级中的控件层,适配控件区在适配应用界面中的目标展示位置,是在控件层中,基于目标动态信息引导区的下边界,与适配应用界面的下边界之间的空白区域的像素尺寸确定的。In some embodiments, the adaptation control area is located in the control layer of each business level of the target application. The target display position of the adaptation control area in the adaptation application interface is determined by the pixel size of the blank area between the lower boundary of the target dynamic information guide area and the lower boundary of the adaptation application interface in the control layer.
在基准应用界面中,基准动态信息引导区一般显示在最左侧,基准控件区一般展示在基准动态信息引导区的右侧。然而,在车载应用场景中,基准应用界面的左侧靠近驾驶员,是操作和显示的黄金区域。因此,在进行界面适配时,若适配应用界面左侧在展示目标动态信息引导区后,还存在空白区域,则可以将适配控件区移动至目标动态信息引导区的下方进行展示,这样可以很好地利用适配应用界面中的黄金区域,也便于驾驶员操作。In a baseline application interface, the baseline dynamic information guidance area is typically displayed on the far left, while the baseline control area is usually displayed to the right of it. However, in automotive applications, the left side of the baseline application interface, closer to the driver, is the prime area for operation and display. Therefore, when adapting the interface, if there is still blank space on the left side after displaying the target dynamic information guidance area, the adapted control area can be moved below the target dynamic information guidance area. This makes good use of the prime area in the adapted application interface and facilitates driver operation.
鉴于此,本申请实施例中,若上述空白区域的像素尺寸大于预设阈值,则将空白区域作为适配控件区在适配应用界面中的目标展示位置。若空白区域的像素尺寸小于等于预设阈值,则基于基准动态信息引导区和基准控件区在基准应用界面中的展示位置关系,以及目标动态信息引导区在适配应用界面中的展示位置,确定适配控件区在适配应用界面中的目标展示位置。Therefore, in this embodiment, if the pixel size of the aforementioned blank area is greater than a preset threshold, the blank area is taken as the target display position of the adaptation control area in the adaptation application interface. If the pixel size of the blank area is less than or equal to the preset threshold, the target display position of the adaptation control area in the adaptation application interface is determined based on the display position relationship between the baseline dynamic information guidance area and the baseline control area in the baseline application interface, and the display position of the target dynamic information guidance area in the adaptation application interface.
具体地,当空白区域的像素尺寸大于预设阈值,说明目标动态信息引导区的下边界与适配应用界面的下边界之间的空白区域还可以展示适配控件区,因此,将该空白区域作为适配控件区在适配应用界面中的目标展示位置。Specifically, when the pixel size of the blank area is greater than a preset threshold, it means that the blank area between the lower boundary of the target dynamic information guidance area and the lower boundary of the adapted application interface can still display the adapted control area. Therefore, this blank area is taken as the target display position of the adapted control area in the adapted application interface.
若空白区域的像素尺寸小于等于预设阈值,则说明目标动态信息引导区的下边界与适配应用界面的下边界之间的空白区域无法展示适配控件区,则基于基准动态信息引导区和基准控件区在基准应用界面中的展示位置关系,确定目标动态信息引导区与适配控件区在适配应用界面中的展示位置关系,然后再基于目标动态信息引导区与适配控件区在适配应用界面中的展示位置关系,以及目标动态信息引导区在适配应用界面中的展示位置,确定适配控件区在适配应用界面中的目标展示位置。If the pixel size of the blank area is less than or equal to a preset threshold, it means that the blank area between the lower boundary of the target dynamic information guide area and the lower boundary of the adapted application interface cannot display the adapted control area. Then, based on the display position relationship between the benchmark dynamic information guide area and the benchmark control area in the benchmark application interface, the display position relationship between the target dynamic information guide area and the adapted control area in the adapted application interface is determined. Then, based on the display position relationship between the target dynamic information guide area and the adapted control area in the adapted application interface, and the display position of the target dynamic information guide area in the adapted application interface, the target display position of the adapted control area in the adapted application interface is determined.
举例来说,如图11所示,设定基准屏幕的基准分辨率为1920px*720px,基准屏幕的dpi=160,基准控件区1101位于基准动态信息引导区1102的右下角。目标屏幕的目标分辨率为1920px*1080px,目标屏幕的dpi=160。For example, as shown in Figure 11, the baseline resolution of the baseline screen is set to 1920px * 720px, the baseline screen dpi = 160, and the baseline control area 1101 is located in the lower right corner of the baseline dynamic information guide area 1102. The target resolution of the target screen is 1920px * 1080px, and the target screen dpi = 160.
设定目标屏幕在展示了基准动态信息引导区1102对应的目标动态信息引导区1103的全部内容之后,目标动态信息引导区1103的下边界与适配应用界面的下边界之间存在空白区域,且该空白区域的像素尺寸大于预设阈值,则在目标动态信息引导区1103的下方显示适配控件区1104。After the target screen displays all the content of the target dynamic information guide area 1103 corresponding to the baseline dynamic information guide area 1102, if there is a blank area between the lower boundary of the target dynamic information guide area 1103 and the lower boundary of the adapted application interface, and the pixel size of the blank area is greater than a preset threshold, then the adapted control area 1104 is displayed below the target dynamic information guide area 1103.
需要说明的是,若目标动态信息引导区1103的下边界与适配应用界面的下边界之间的空白区域的像素尺寸小于等于预设阈值,则在目标动态信息引导区1103的右下角显示适配控件区1104。It should be noted that if the pixel size of the blank area between the lower boundary of the target dynamic information guidance area 1103 and the lower boundary of the adapted application interface is less than or equal to a preset threshold, the adapted control area 1104 will be displayed in the lower right corner of the target dynamic information guidance area 1103.
本申请实施例中,基于适配应用界面展示适配信息引导区的情况,动态调整适配控件区在适配应用界面中的展示位置,针对屏幕个体差异而增加了对界面细节的把控,更合理的利用了应用界面的空间,也提高了操作的便利性。In this embodiment, based on the display of the adaptation information guidance area in the adaptation application interface, the display position of the adaptation control area in the adaptation application interface is dynamically adjusted. This increases the control over interface details to address individual screen differences, makes more reasonable use of the application interface space, and improves the convenience of operation.
为了更好地解释本申请实施例,下面结合具体实施场景介绍本申请实施例提供的一种应用界面适配的方法,该方法的流程可以由图1所示的终端设备101执行,也可以由服务器102执行,还可以由终端设备101与服务器102交互执行,包括以下步骤,如图12所示:To better explain the embodiments of this application, the following describes a method for application interface adaptation provided by the embodiments of this application in conjunction with a specific implementation scenario. The process of this method can be executed by the terminal device 101 shown in Figure 1, or by the server 102, or by the interaction between the terminal device 101 and the server 102. It includes the following steps, as shown in Figure 12:
步骤S1201,获取目标屏幕的目标分辨率、原始点密度和原始屏幕密度。Step S1201: Obtain the target resolution, original pixel density, and original screen density of the target screen.
步骤S1202,对目标屏幕进行屏幕标准化调整。Step S1202: Perform screen standardization adjustments on the target screen.
具体地,基于目标屏幕的目标分辨率和目标屏幕的原始屏幕密度,确定目标屏幕的有效宽度和有效高度。将有效宽度与基准宽度的比值,作为第一差异度;以及将有效高度与基准高度的比值,作为第二差异度。Specifically, based on the target screen's target resolution and original screen density, the effective width and effective height of the target screen are determined. The ratio of the effective width to the reference width is used as the first difference factor; and the ratio of the effective height to the reference height is used as the second difference factor.
若第一差异度或所述第二差异度均大于1,则不需要对目标屏幕进行屏幕标准化调整,直接将目标屏幕的原始点密度,作为目标屏幕的目标点密度。若第一差异度或所述第二差异度小于1,则需要对目标屏幕进行屏幕标准化调整;对目标屏幕进行屏幕标准化调整的过程具体如下:If either the first or second difference score is greater than 1, screen standardization adjustment is not required for the target screen; the original pixel density of the target screen is directly used as the target pixel density. If either the first or second difference score is less than 1, screen standardization adjustment is required for the target screen. The specific process for screen standardization adjustment is as follows:
若第一差异度大于第二差异度,则将高度方向作为目标屏幕的标准化调整方向;若第一差异度小于等于第二差异度,则将宽度方向作为目标屏幕的标准化调整方向。基于目标屏幕的目标分辨率,确定目标屏幕在标准化调整方向上对应的目标像素数量。将目标像素数量与基准屏幕在标准化调整方向上的基准像素数量的比值,作为目标屏幕密度。然后将目标屏幕密度与基准屏幕的基准点密度的乘积,作为目标点密度。If the first difference is greater than the second difference, the height direction is used as the normalization adjustment direction for the target screen; if the first difference is less than or equal to the second difference, the width direction is used as the normalization adjustment direction for the target screen. Based on the target resolution of the target screen, the number of target pixels corresponding to the target screen in the normalization adjustment direction is determined. The ratio of the number of target pixels to the number of reference pixels of the reference screen in the normalization adjustment direction is used as the target screen density. Then, the product of the target screen density and the reference pixel density of the reference screen is used as the target pixel density.
步骤S1203,业务分层。Step S1203, business layering.
具体地,将目标应用拆分为多个业务层级,多个独立的业务层级包括通知层、支线层、主线层、控件层和底图层,每个业务层级承载不同的业务功能,并预先设定各个业务层级之间的跳转逻辑和公共关系。Specifically, the target application is split into multiple business layers, including a notification layer, a branch layer, a main layer, a control layer, and a bottom layer. Each business layer carries different business functions, and the jump logic and common relationships between each business layer are pre-defined.
步骤S1204,物理适配。Step S1204, physical adaptation.
具体地,针对应用界面中的界面元素,将界面元素的基准虚拟像素尺寸,作为界面元素在适配应用界面中的目标虚拟像素尺寸,然后基于界面元素的目标虚拟像素尺寸和目标屏幕的目标点密度,确定界面元素在适配应用界面中的目标像素尺寸。基于界面元素的目标像素尺寸以及目标屏幕中单位像素的物理尺寸,确定界面元素在适配应用界面中呈现的物理尺寸。此时,界面元素在适配应用界面中呈现的物理尺寸,与界面元素在基准应用界面中呈现的物理尺寸相同。Specifically, for interface elements in the application interface, the baseline virtual pixel size of the interface element is used as the target virtual pixel size of the interface element in the adapted application interface. Then, based on the target virtual pixel size of the interface element and the target pixel density of the target screen, the target pixel size of the interface element in the adapted application interface is determined. Based on the target pixel size of the interface element and the physical size of a unit pixel in the target screen, the physical size of the interface element presented in the adapted application interface is determined. At this point, the physical size of the interface element presented in the adapted application interface is the same as the physical size of the interface element presented in the baseline application interface.
具体地,针对应用界面中的功能区,功能区指应用界面中承载界面元素的信息容器,一个功能区中包括一个或多个界面元素,功能区可以是信息引导区、控件区等。以信息引导区展开来说,将基准信息引导区的基准虚拟像素尺寸,作为相应的适配信息引导区在适配应用界面中的目标虚拟像素尺寸,然后基于适配信息引导区的目标虚拟像素尺寸和目标屏幕的目标点密度,确定适配信息引导区在适配应用界面中的初步像素尺寸。对其他功能区进行物理适配的方法与对信息引导区进行物理适配的方法相同,此处不再赘述。Specifically, regarding the functional areas in the application interface, a functional area refers to an information container that carries interface elements. A functional area includes one or more interface elements and can be an information guide area, a control area, etc. Taking the information guide area as an example, the baseline virtual pixel size of the baseline information guide area is used as the target virtual pixel size of the corresponding adapted information guide area in the adapted application interface. Then, based on the target virtual pixel size of the adapted information guide area and the target pixel density of the target screen, the initial pixel size of the adapted information guide area in the adapted application interface is determined. The method for physically adapting other functional areas is the same as that for physically adapting the information guide area, and will not be repeated here.
步骤S1205,动态调整。Step S1205: Dynamic adjustment.
具体地,在物理适配,获得适配功能区的初步像素尺寸之后,还需要对适配功能区的初步像素尺寸进行动态调整,获得适配功能区的目标像素尺寸,适配功能区包括适配信息引导区、适配控件区等。Specifically, after obtaining the initial pixel size of the adaptation function area through physical adaptation, it is necessary to dynamically adjust the initial pixel size of the adaptation function area to obtain the target pixel size of the adaptation function area. The adaptation function area includes the adaptation information guidance area, the adaptation control area, etc.
以适配信息引导区展开来说,基于初步像素尺寸,确定适配信息引导区的初步像素宽度和初步像素高度。基于基准屏幕的基准宽度、基准屏幕的基准点密度和目标屏幕的目标点密度,确定适配信息引导区的目标宽度调整范围。然后基于目标屏幕的目标宽度以及宽度调整范围,对初步像素宽度进行调整,获得适配信息引导区的目标像素宽度。然后基于目标屏幕的目标高度和基准信息引导区的展示状态信息,确定初步像素高度的高度调整值和适配信息引导区的元素调整数量。基于高度调整值和初步像素高度,确定适配信息引导区的目标像素高度。然后基于适配信息引导区的目标像素宽度和目标像素高度,获得适配信息引导区的目标像素尺寸。Taking the adaptation information guide area as an example, based on the initial pixel size, the initial pixel width and initial pixel height of the adaptation information guide area are determined. Based on the baseline width and pixel density of the baseline screen and the target pixel density of the target screen, the target width adjustment range of the adaptation information guide area is determined. Then, based on the target width of the target screen and the width adjustment range, the initial pixel width is adjusted to obtain the target pixel width of the adaptation information guide area. Next, based on the target height of the target screen and the display status information of the baseline information guide area, the initial pixel height adjustment value and the number of elements to be adjusted in the adaptation information guide area are determined. Based on the height adjustment value and the initial pixel height, the target pixel height of the adaptation information guide area is determined. Finally, based on the target pixel width and target pixel height of the adaptation information guide area, the target pixel size of the adaptation information guide area is obtained.
基于适配信息引导区的目标像素尺寸以及目标屏幕中单位像素的物理尺寸,确定适配信息引导区在适配应用界面中呈现的物理尺寸。此时,由于适配信息引导区的目标像素尺寸与适配信息引导区的初步像素尺寸可能是不同的,因此,适配信息引导区在适配应用界面中呈现的物理尺寸,与适配信息引导区在基准应用界面中呈现的物理尺寸也可能是不同的。Based on the target pixel size of the adaptation information guide area and the physical size of a unit pixel on the target screen, the physical size of the adaptation information guide area presented in the adapted application interface is determined. However, since the target pixel size of the adaptation information guide area may differ from its initial pixel size, the physical size presented in the adapted application interface may also differ from the physical size presented in the baseline application interface.
需要说明的是,在对适配信息引导区进行动态调整时,仅调整适配信息引导区这一信息容器的像素尺寸,并不会调整适配信息引导区中的界面元素的像素尺寸。另外,由于适配信息引导区位于图4所示的各个业务层级中的主线层403,因此,在对适配信息引导区进行动态调整时,只需要调整主线层403中的适配信息引导区,而不需要调整其他业务层。It should be noted that when dynamically adjusting the adaptation information guide area, only the pixel size of this information container is adjusted, and the pixel size of the interface elements within the adaptation information guide area is not adjusted. Furthermore, since the adaptation information guide area is located in the main layer 403 of the various business layers shown in Figure 4, when dynamically adjusting the adaptation information guide area, only the adaptation information guide area in the main layer 403 needs to be adjusted, and other business layers do not need to be adjusted.
另外,在调整适配信息引导区的初步像素高度时,基于目标屏幕的目标高度和基准信息引导区的展示状态信息,确定适配信息引导区的元素调整数量。然后基于元素调整数量和基准信息引导区在基准应用界面中展示的界面元素的基准数量,确定适配信息引导区在适配应用界面中展示的界面元素的目标数量,并在适配信息引导区中展示目标数量的界面元素。Additionally, when adjusting the initial pixel height of the adaptation information guide area, the number of elements to be adjusted in the adaptation information guide area is determined based on the target height of the target screen and the display status information of the baseline information guide area. Then, based on the number of elements adjusted and the baseline number of interface elements displayed in the baseline application interface by the baseline information guide area, the target number of interface elements to be displayed in the adaptation application interface by the adaptation information guide area is determined, and the target number of interface elements is displayed in the adaptation information guide area.
针对适配控件区,采用确定上述适配信息引导区的目标像素尺寸相同的方式,确定适配控件区的目标像素尺寸之后,若位于目标屏幕最左侧的目标动态信息引导区的下边界与适配应用界面的下边界之间的空白区域的像素尺寸大于预设阈值,则在目标动态信息引导区的下方展示适配控件区。For the adaptation control area, the target pixel size is determined to be the same as that of the above-mentioned adaptation information guide area. After determining the target pixel size of the adaptation control area, if the pixel size of the blank area between the lower boundary of the target dynamic information guide area on the far left of the target screen and the lower boundary of the adaptation application interface is greater than a preset threshold, then the adaptation control area is displayed below the target dynamic information guide area.
另外,在对适配控件区进行动态调整时,仅调整适配控件区这一信息容器的像素尺寸,并不会调整适配控件区中的界面元素的像素尺寸。由于适配控件区位于图4所示的各个业务层级中的控件层404,因此,在对适配控件区进行动态调整时,只需要调整控件层404中的适配控件区,而不需要调整其他业务层。Furthermore, when dynamically adjusting the adaptation control area, only the pixel size of this information container is adjusted; the pixel sizes of the interface elements within the adaptation control area are not adjusted. Since the adaptation control area is located in control layer 404 of each business layer shown in Figure 4, when dynamically adjusting the adaptation control area, only the adaptation control area within control layer 404 needs to be adjusted, without needing to adjust other business layers.
本申请实施例中,以界面元素的基准虚拟像素尺寸与界面元素的目标虚拟像素尺寸相等为基准,结合界面元素的虚拟像素尺寸、像素尺寸、点密度三者之间的关系,确定适配应用界面中的界面元素的第一物理尺寸,以保证适配应用界面中的每个界面元素在适配应用界面中呈现的第一物理尺寸,与相应的界面元素在基准应用界面中相应呈现的第二物理尺寸相同,从而使得目标屏幕上展示的适配应用界面中的各个界面元素,与基准屏幕上展示的基准应用界面中相应的各个界面元素的视觉呈现效果相同,也保证了不同终端设备上呈现的适配应用界面中的界面元素的视觉呈现效果相同,进而提高对象的使用体验。其次,通过对目标屏幕进行标准化调整,使得一套基准应用界面,可以满足车载、平板和手机等不同屏幕的适配要求,避免了重复设计基准应用界面带来的资源浪费。另外在对应用界面中的功能区进行物理适配之后,进一步对功能区进行动态调整(包括左右适配和上下适配),并调整某些功能区在应用界面中的展示位置,增加了对细节的把控,更合理的利用了应用界面的空间。In this embodiment, the first physical size of the interface elements in the adapted application interface is determined by taking the equality of the baseline virtual pixel size and the target virtual pixel size of the interface elements as a benchmark, and combining the relationship between the virtual pixel size, pixel size, and dot density of the interface elements. This ensures that the first physical size of each interface element in the adapted application interface is the same as the second physical size of the corresponding interface element in the baseline application interface. This ensures that the visual presentation effect of each interface element in the adapted application interface displayed on the target screen is the same as that of the corresponding interface elements in the baseline application interface displayed on the baseline screen. It also ensures that the visual presentation effect of the interface elements in the adapted application interface displayed on different terminal devices is the same, thereby improving the user experience. Secondly, by standardizing the target screen, a single baseline application interface can meet the adaptation requirements of different screens such as automotive, tablet, and mobile phones, avoiding the waste of resources caused by repeatedly designing baseline application interfaces. In addition, after physically adapting the function areas in the application interface, we further dynamically adjusted the function areas (including left-right and top-bottom adaptation) and adjusted the display position of some function areas in the application interface, which increased the control over details and made more reasonable use of the application interface space.
基于相同的技术构思,本申请实施例提供了一种应用界面适配的装置的结构示意图,如图13所示,该装置1300包括:Based on the same technical concept, this application provides a schematic diagram of the structure of an application interface adaptation device, as shown in Figure 13. The device 1300 includes:
展示模块1301,用于响应于针对目标应用的触发操作,通过目标屏幕展示所述目标应用的适配应用界面,其中,所述适配应用界面中包括多个界面元素,每个所述界面元素在所述适配应用界面中呈现的第一物理尺寸,与相应的界面元素在基准应用界面中相应呈现的第二物理尺寸相同;The display module 1301 is used to respond to a trigger operation for the target application and display the adapted application interface of the target application through the target screen. The adapted application interface includes multiple interface elements, and the first physical size of each interface element in the adapted application interface is the same as the second physical size of the corresponding interface element in the base application interface.
每个所述第一物理尺寸,是基于所述界面元素在所述适配应用界面中的目标虚拟像素尺寸,以及所述目标屏幕的目标点密度确定的,所述目标虚拟像素尺寸与所述界面元素在基准应用界面中的基准虚拟像素尺寸相同。Each of the first physical dimensions is determined based on the target virtual pixel size of the interface element in the adapted application interface and the target point density of the target screen, wherein the target virtual pixel size is the same as the reference virtual pixel size of the interface element in the base application interface.
可选地,还包括处理模块1302;Optionally, it also includes a processing module 1302;
所述处理模块1302具体用于:The processing module 1302 is specifically used for:
基于所述界面元素的目标虚拟像素尺寸和所述目标点密度,确定所述界面元素在所述适配应用界面中的目标像素尺寸;Based on the target virtual pixel size of the interface element and the target point density, determine the target pixel size of the interface element in the adapted application interface;
基于所述界面元素的目标像素尺寸,确定所述界面元素在所述适配应用界面中呈现的第一物理尺寸。Based on the target pixel size of the interface element, determine the first physical size of the interface element as presented in the adapted application interface.
可选地,所述处理模块1302还用于:Optionally, the processing module 1302 is further configured to:
基于所述目标屏幕的目标分辨率和所述目标屏幕的原始屏幕密度,确定所述目标屏幕的有效宽度和有效高度;Based on the target resolution and the original screen density of the target screen, determine the effective width and effective height of the target screen;
基于所述有效宽度与所述基准屏幕的基准宽度之间的第一差异度,以及所述有效高度与所述基准屏幕的基准高度之间的第二差异度,确定所述目标屏幕的标准化调整方向;Based on the first difference between the effective width and the reference width of the reference screen, and the second difference between the effective height and the reference height of the reference screen, the standardization adjustment direction of the target screen is determined;
基于所述标准化调整方向,对所述目标屏幕的原始像素密度进行调整,获得目标点密度。Based on the standardized adjustment direction, the original pixel density of the target screen is adjusted to obtain the target pixel density.
可选地,所述处理模块1302还用于:Optionally, the processing module 1302 is further configured to:
基于所述有效宽度与所述基准屏幕的基准宽度之间的第一差异度,以及所述有效高度与所述基准屏幕的基准高度之间的第二差异度,确定所述目标屏幕的标准化调整方向之前,基于所述有效宽度与所述基准宽度的比值,确定第一差异度;以及基于所述有效高度与所述基准高度的比值,确定第二差异度;Before determining the standardization adjustment direction of the target screen based on a first difference between the effective width and the reference width of the reference screen, and a second difference between the effective height and the reference height of the reference screen, the first difference is determined based on the ratio of the effective width to the reference width; and the second difference is determined based on the ratio of the effective height to the reference height.
确定所述第一差异度或所述第二差异度小于1。Determine that either the first difference or the second difference is less than 1.
可选地,所述处理模块1302具体用于:Optionally, the processing module 1302 is specifically used for:
若所述第一差异度大于所述第二差异度,则将高度方向作为所述目标屏幕的标准化调整方向;If the first difference is greater than the second difference, then the height direction is used as the standardization adjustment direction of the target screen;
若所述第一差异度小于等于所述第二差异度,则将宽度方向作为所述目标屏幕的标准化调整方向。If the first difference degree is less than or equal to the second difference degree, then the width direction is used as the standardization adjustment direction of the target screen.
可选地,所述处理模块1302具体用于:Optionally, the processing module 1302 is specifically used for:
基于所述目标分辨率,确定所述目标屏幕在所述标准化调整方向上对应的目标像素数量;Based on the target resolution, determine the number of target pixels corresponding to the target screen in the normalization adjustment direction;
基于所述目标像素数量,以及所述基准屏幕在所述标准化调整方向上对应的基准像素数量,对所述原始屏幕密度进行调整,获得目标屏幕密度;Based on the target number of pixels and the reference number of pixels of the reference screen corresponding to the normalization adjustment direction, the original screen density is adjusted to obtain the target screen density;
基于所述目标屏幕密度以及所述基准点密度,对所述原始像素密度进行调整,确定所述目标点密度。Based on the target screen density and the reference point density, the original pixel density is adjusted to determine the target point density.
可选地,所述适配应用界面还包括多个适配信息引导区,每个适配信息引导区用于展示与一类引导信息关联的界面元素;Optionally, the adapted application interface also includes multiple adaptation information guidance areas, each of which is used to display interface elements associated with a type of guidance information;
每个所述适配信息引导区在所述适配应用界面中呈现的物理宽度,是根据所述适配信息引导区的初步像素尺寸和所述目标屏幕的目标宽度确定的,其中,所述适配信息引导区的初步像素尺寸,是基于相应的基准信息引导区在所述基准应用界面中的基准虚拟像素尺寸,以及所述目标点密度确定的;The physical width of each of the adaptation information guide areas presented in the adaptation application interface is determined based on the initial pixel size of the adaptation information guide area and the target width of the target screen. The initial pixel size of the adaptation information guide area is determined based on the reference virtual pixel size of the corresponding reference information guide area in the reference application interface and the target point density.
每个所述适配信息引导区在所述适配应用界面中呈现的物理高度,以及每个所述适配信息引导区展示的界面元素的目标数量,是根据所述适配信息引导区的初步像素尺寸以及所述目标屏幕的目标高度确定的。The physical height of each adaptation information guide area presented in the adaptation application interface, and the target number of interface elements displayed in each adaptation information guide area, are determined based on the initial pixel size of the adaptation information guide area and the target height of the target screen.
可选地,所述处理模块1302还用于:Optionally, the processing module 1302 is further configured to:
基于基准宽度范围和所述基准屏幕的基准点密度,确定所述适配信息引导区的目标宽度调整范围;Based on the reference width range and the reference point density of the reference screen, the target width adjustment range of the adaptation information guidance area is determined;
基于所述初步像素尺寸,确定所述适配信息引导区的初步像素宽度;Based on the initial pixel size, determine the initial pixel width of the adaptation information guidance area;
基于所述目标屏幕的目标宽度以及所述宽度调整范围,对所述初步像素宽度进行调整,获得所述适配信息引导区的目标像素宽度,并基于所述目标像素宽度,确定所述适配信息引导区在所述适配应用界面中呈现的物理宽度。Based on the target width of the target screen and the width adjustment range, the initial pixel width is adjusted to obtain the target pixel width of the adaptation information guide area, and based on the target pixel width, the physical width of the adaptation information guide area presented in the adaptation application interface is determined.
可选地,所述处理模块1302具体用于:Optionally, the processing module 1302 is specifically used for:
将所述基准宽度范围对应的预设点密度和所述基准屏幕的基准点密度的比值,作为所述基准宽度调整范围的调整比例;The ratio of the preset point density corresponding to the reference width range to the reference point density of the reference screen is used as the adjustment ratio of the reference width adjustment range;
将所述基准宽度调整范围的上下边界值,分别与所述调整比例相乘,获得所述适配信息引导区的目标宽度调整范围。The target width adjustment range of the adaptation information guidance area is obtained by multiplying the upper and lower boundary values of the reference width adjustment range by the adjustment ratio.
可选地,所述处理模块1302还用于:Optionally, the processing module 1302 is further configured to:
基于所述初步像素尺寸,确定所述适配信息引导区的初步像素高度;Based on the initial pixel size, determine the initial pixel height of the adaptation information guidance area;
基于所述目标高度和所述基准信息引导区的展示状态信息,确定所述初步像素高度的高度调整值;Based on the target height and the display status information of the reference information guide area, the height adjustment value of the preliminary pixel height is determined;
基于所述高度调整值和所述初步像素高度,确定所述适配信息引导区的目标像素高度,并基于所述目标像素高度,确定所述适配信息引导区在所述适配应用界面中呈现的物理高度。Based on the height adjustment value and the preliminary pixel height, the target pixel height of the adaptation information guide area is determined, and based on the target pixel height, the physical height of the adaptation information guide area presented in the adaptation application interface is determined.
可选地,所述处理模块1302还用于:Optionally, the processing module 1302 is further configured to:
基于所述目标高度和所述基准信息引导区的展示状态信息,确定所述适配信息引导区的元素调整数量;Based on the target height and the display status information of the baseline information guide area, determine the number of elements to be adjusted in the adaptation information guide area;
基于所述元素调整数量和所述基准信息引导区在基准应用界面中展示的界面元素的基准数量,确定所述适配信息引导区在所述适配应用界面中展示的界面元素的目标数量。Based on the adjusted number of elements and the baseline number of interface elements displayed by the baseline information guide area in the baseline application interface, the target number of interface elements displayed by the adaptation information guide area in the adaptation application interface is determined.
可选地,所述适配应用界面还包括适配控件区,所述适配控件区用于展示与操作控件关联的界面元素,所述多个适配信息引导区中包括目标动态信息引导区;Optionally, the adapted application interface further includes an adapted control area, which is used to display interface elements associated with the operation controls, and the plurality of adapted information guidance areas include a target dynamic information guidance area;
所述适配控件区在所述适配应用界面中的目标展示位置,是基于所述目标动态信息引导区的下边界与所述适配应用界面的下边界之间的空白区域的像素尺寸确定的。The target display position of the adaptation control area in the adaptation application interface is determined based on the pixel size of the blank area between the lower boundary of the target dynamic information guide area and the lower boundary of the adaptation application interface.
可选地,所述处理模块1302还用于:Optionally, the processing module 1302 is further configured to:
若所述空白区域的像素尺寸大于预设阈值,则将所述空白区域作为所述适配控件区在所述适配应用界面中的目标展示位置;If the pixel size of the blank area is greater than a preset threshold, then the blank area will be used as the target display position of the adaptation control area in the adaptation application interface.
若所述空白区域的像素尺寸小于等于预设阈值,则基于基准动态信息引导区和基准控件区在所述基准应用界面中的展示位置关系,以及所述目标动态信息引导区在所述适配应用界面中的展示位置,确定所述适配控件区在所述适配应用界面中的目标展示位置。If the pixel size of the blank area is less than or equal to a preset threshold, the target display position of the adaptation control area in the adaptation application interface is determined based on the display position relationship between the benchmark dynamic information guide area and the benchmark control area in the benchmark application interface, and the display position of the target dynamic information guide area in the adaptation application interface.
可选地,所述目标应用包括多个独立的业务层级,所述多个独立的业务层级包括通知层、支线层、主线层、控件层和底图层。Optionally, the target application includes multiple independent business layers, including a notification layer, a branch layer, a main layer, a control layer, and a bottom layer.
可选地,所述多个适配信息引导区位于所述主线层;Optionally, the plurality of adaptation information guidance areas are located in the mainline layer;
每个所述适配信息引导区在所述适配应用界面中呈现的物理宽度,是在所述主线层中,根据所述适配信息引导区的初步像素尺寸和所述目标屏幕的目标宽度确定的;The physical width of each of the adaptation information guide areas presented in the adaptation application interface is determined in the main layer based on the initial pixel size of the adaptation information guide area and the target width of the target screen;
每个所述适配信息引导区在所述适配应用界面中呈现的物理高度,以及每个所述适配信息引导区展示的界面元素的目标数量,是在所述主线层中,根据所述适配信息引导区的初步像素尺寸以及所述目标屏幕的目标高度确定的。The physical height of each adaptation information guide area presented in the adaptation application interface, and the target number of interface elements displayed by each adaptation information guide area, are determined in the main layer based on the initial pixel size of the adaptation information guide area and the target height of the target screen.
可选地,所述适配控件区位于所述控件层;Optionally, the adaptation control area is located in the control layer;
所述适配控件区在所述适配应用界面中的目标展示位置,是在所述控件层中,基于所述目标动态信息引导区的下边界,与所述适配应用界面的下边界之间的空白区域的像素尺寸确定的。The target display position of the adaptation control area in the adaptation application interface is determined by the pixel size of the blank area between the lower boundary of the target dynamic information guide area and the lower boundary of the adaptation application interface in the control layer.
本申请实施例中,以界面元素的基准虚拟像素尺寸与界面元素的目标虚拟像素尺寸相等为基准,结合界面元素的虚拟像素尺寸、像素尺寸、点密度三者之间的关系,确定适配应用界面中的界面元素的第一物理尺寸,以保证适配应用界面中的每个界面元素在适配应用界面中呈现的第一物理尺寸,与相应的界面元素在基准应用界面中相应呈现的第二物理尺寸相同,从而使得目标屏幕上展示的适配应用界面中的各个界面元素,与基准屏幕上展示的基准应用界面中相应的各个界面元素的视觉呈现效果相同,也保证了不同终端设备上呈现的适配应用界面中的界面元素的视觉呈现效果相同,进而提高对象的使用体验。In this embodiment, the first physical size of the interface elements in the adapted application interface is determined by taking the equality of the base virtual pixel size and the target virtual pixel size of the interface elements as a benchmark, and combining the relationship between the virtual pixel size, pixel size, and dot density of the interface elements. This ensures that the first physical size of each interface element in the adapted application interface is the same as the second physical size of the corresponding interface element in the base application interface. As a result, the visual presentation effect of each interface element in the adapted application interface displayed on the target screen is the same as that of the corresponding interface elements in the base application interface displayed on the base screen. This also ensures that the visual presentation effect of the interface elements in the adapted application interface displayed on different terminal devices is the same, thereby improving the user experience.
基于相同的技术构思,本申请实施例提供了一种计算机设备,该计算机设备可以是图1所示的终端设备和/或服务器,如图14所示,包括至少一个处理器1401,以及与至少一个处理器连接的存储器1402,本申请实施例中不限定处理器1401与存储器1402之间的具体连接介质,图14中处理器1401和存储器1402之间通过总线连接为例。总线可以分为地址总线、数据总线、控制总线等。Based on the same technical concept, this application provides a computer device, which may be the terminal device shown in FIG1 and/or a server. As shown in FIG14, it includes at least one processor 1401 and a memory 1402 connected to at least one processor. This application does not limit the specific connection medium between the processor 1401 and the memory 1402. FIG14 shows an example where the processor 1401 and the memory 1402 are connected via a bus. The bus can be divided into address bus, data bus, control bus, etc.
在本申请实施例中,存储器1402存储有可被至少一个处理器1401执行的指令,至少一个处理器1401通过执行存储器1402存储的指令,可以执行上述应用界面适配的方法的步骤。In this embodiment of the application, the memory 1402 stores instructions that can be executed by at least one processor 1401. By executing the instructions stored in the memory 1402, at least one processor 1401 can perform the steps of the above-described application interface adaptation method.
其中,处理器1401是计算机设备的控制中心,可以利用各种接口和线路连接计算机设备的各个部分,通过运行或执行存储在存储器1402内的指令以及调用存储在存储器1402内的数据,从而实现应用界面适配。可选的,处理器1401可包括一个或多个处理单元,处理器1401可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器1401中。在一些实施例中,处理器1401和存储器1402可以在同一芯片上实现,在一些实施例中,它们也可以在独立的芯片上分别实现。The processor 1401 is the control center of the computer device, capable of connecting various parts of the computer device via various interfaces and lines. It adapts the application interface by running or executing instructions stored in the memory 1402 and accessing data stored in the memory 1402. Optionally, the processor 1401 may include one or more processing units. The processor 1401 may integrate an application processor and a modem processor. The application processor primarily handles the operating system, user interface, and applications, while the modem processor primarily handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1401. In some embodiments, the processor 1401 and the memory 1402 may be implemented on the same chip; in other embodiments, they may be implemented on separate chips.
处理器1401可以是通用处理器,例如中央处理器(CPU)、数字信号处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本申请实施例中公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。Processor 1401 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
存储器1402作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块。存储器1402可以包括至少一种类型的存储介质,例如可以包括闪存、硬盘、多媒体卡、卡型存储器、随机访问存储器(Random AccessMemory,RAM)、静态随机访问存储器(Static Random Access Memory,SRAM)、可编程只读存储器(Programmable Read Only Memory,PROM)、只读存储器(Read Only Memory,ROM)、带电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、磁性存储器、磁盘、光盘等等。存储器1402是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机设备存取的任何其他介质,但不限于此。本申请实施例中的存储器1402还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和/或数据。Memory 1402, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 1402 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic memory, magnetic disk, optical disk, etc. Memory 1402 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer device, but is not limited thereto. In the embodiments of this application, memory 1402 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and/or data.
基于同一发明构思,本申请实施例提供了一种计算机可读存储介质,其存储有可由计算机设备执行的计算机程序,当程序在计算机设备上运行时,使得计算机设备执行上述应用界面适配的方法的步骤。Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium storing a computer program executable by a computer device, which, when run on the computer device, causes the computer device to perform the steps of the above-described application interface adaptation method.
基于同一发明构思,本申请实施例提供了一种计算机程序产品,所述计算机程序产品包括存储在计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机设备执行时,使所述计算机设备执行上述应用界面适配的方法的步骤。Based on the same inventive concept, this application provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions, which, when executed by a computer device, cause the computer device to perform the steps of the above-described application interface adaptation method.
本领域内的技术人员应明白,本发明的实施例可提供为方法、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will understand that embodiments of the present invention can be provided as methods or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。This invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more blocks of the flowchart illustrations and/or one or more blocks of the block diagrams.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and/or one or more block diagrams.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and/or one or more block diagrams.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims (17)
Publications (2)
| Publication Number | Publication Date |
|---|---|
| HK40068134A HK40068134A (en) | 2022-09-16 |
| HK40068134B true HK40068134B (en) | 2023-10-27 |
Family
ID=
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN114610426B (en) | Method, device, equipment and storage medium for adjusting interface layout | |
| US10445914B2 (en) | Method and apparatus for contextually varying imagery on a map | |
| US9535890B2 (en) | Flexible control in resizing of visual displays | |
| US9342618B2 (en) | Web application compositon and modification editor | |
| US20200402201A1 (en) | Media Content Management for A Fixed Orientation Display | |
| US9401007B2 (en) | Image providing system, apparatus for same, and image providing method | |
| WO2022116936A1 (en) | Interface layout method, electronic device, and computer-readable storage medium. | |
| CN112579927A (en) | Method and device for displaying navigation bar | |
| US12153940B2 (en) | Path-driven user interface | |
| HK40068134B (en) | Method and apparatus for adjusting interface layout, device, and storage medium | |
| US11157156B2 (en) | Speed-based content rendering | |
| WO2025108129A1 (en) | Method for generating graphical user interface of application and related device | |
| US20230083051A1 (en) | Interaction method and apparatus based on electronic map, electronic device, computer-readable storage medium, and computer program product | |
| HK40068134A (en) | Method and apparatus for adjusting interface layout, device, and storage medium | |
| CN107027056B (en) | A desktop configuration method, server and client | |
| CN111782740A (en) | Seat data processing method, computing device and storage medium | |
| CN109657146A (en) | Distributed search method, device and system, main server and regional server | |
| US9552436B2 (en) | Serving expandable content items | |
| CN118963879B (en) | A display control method and electronic device | |
| US20250117999A1 (en) | Systems and methods for arranging design elements | |
| CN114168027B (en) | Information display method, device and equipment | |
| CN109739595B (en) | WEB interaction-based TIP display content processing method and device and electronic equipment | |
| CN109710355B (en) | WEB interaction-based TIP display content processing method and device and electronic equipment | |
| CN116774984A (en) | Calendar display assembly processing method and device, electronic equipment and storage medium | |
| CN121145820A (en) | Method and device for generating form page, electronic equipment and storage medium |