Adaptive layout method

By using an adaptive layout method, the measurement space is divided according to the weight of child controls, and the font size is adjusted uniformly after the layout is completed. This solves the problem of incomplete and inconsistent text display of child controls in the page layout, and achieves visual uniformity and efficient space utilization.

CN122173181APending Publication Date: 2026-06-09DONGFENG MOTOR GRP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DONGFENG MOTOR GRP
Filing Date
2026-02-11
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

In existing technologies, when the text content lengths of child controls in a page layout vary significantly, a fixed font size scheme results in incomplete or inconsistent text display, affecting user experience and incurring high performance overhead.

Method used

The adaptive layout method divides the measurement space for child controls according to their weights. In response to the completion of the measurement space division, the initial text size of each child control is obtained and modified to the minimum text size among the initial text sizes. A global layout listener is used to ensure that the adjustment is done in one go.

Benefits of technology

It achieves dynamic calculation and uniformity of font size across all subspaces after layout is completed, solving problems such as incomplete text display, visual inconsistency, and high performance overhead, and ensuring visual uniformity and efficient space utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122173181A_ABST
    Figure CN122173181A_ABST
Patent Text Reader

Abstract

This invention provides an adaptive layout method, belonging to the field of page layout technology. The adaptive layout method includes: dividing a measurement space for child controls according to their weights; in response to the completion of the measurement space division, obtaining an initial text size for each child control; the initial text size is the maximum text size that can be displayed within the measurement space; and modifying the text size of each child control to the minimum text size among the initial text sizes. This invention calculates the maximum uniform font size that allows all options to display text completely in one step after the layout is completed, ensuring complete text display with only one size adjustment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of page layout technology, and in particular to an adaptive layout method. Background Technology

[0002] In existing page layout development practices, the traditional approach of using a fixed font size has obvious drawbacks when the text content of various child controls varies significantly in length. Long text options often fail to display completely due to insufficient space, resulting in truncation or ellipses, which severely affects user recognition and operation. Summary of the Invention

[0003] The present invention aims to solve at least one of the technical problems existing in the prior art, and proposes an adaptive layout method that completes size adjustment in one step.

[0004] In a first aspect, embodiments of the present invention provide an adaptive layout method, comprising: dividing a measurement space for child controls according to weights; in response to the completion of the measurement space division, obtaining an initial text size for each child control; the initial text size being the maximum text size that can be displayed in the measurement space; and modifying the text size of each child control to the minimum text size among the initial text sizes.

[0005] According to an embodiment of the present invention, dividing the measurement space of a sub-control according to its weight includes: obtaining custom attributes; the custom attributes include at least one of layout direction, number of grid rows and columns, initial text size, text size range, and sub-control margin; in response to the sub-control being linearly arranged, calculating the measurement space of the sub-control based on the layout direction, sub-control weight, sub-control margin, and page size; in response to the sub-control being grid-arranged, calculating the measurement space of the sub-control based on the number of grid rows and columns, sub-control weight, sub-control margin, and page size.

[0006] According to an embodiment of the present invention, the sub-control is a radio button.

[0007] According to an embodiment of the present invention, in response to the completion of the measurement space division, the initial text size is obtained for each child control, and before that, a global layout listener is registered to detect whether the measurement space division is complete.

[0008] According to an embodiment of the present invention, the text size of each child control is modified to the minimum text size among the initial text sizes, and then the global layout listener is removed.

[0009] According to an embodiment of the present invention, obtaining the initial text size for each child control includes: traversing all subviews and filtering out child control instances; obtaining the text size rendered by each child control under the current measurement space conditions.

[0010] According to an embodiment of the present invention, modifying the text size of each child control to the minimum text size among the initial text sizes includes: comparing the initial text sizes of the child controls and determining the minimum text size; disabling the original auto-scaling property of the child controls; and uniformly setting the text size of the child controls to the minimum text size.

[0011] Secondly, the present invention provides an adaptive layout system that can be used to implement the above-mentioned adaptive layout method, including: a preliminary division module, used to divide the measurement space for the sub-controls according to the layout direction and weight; a size acquisition module, used to acquire the initial text size for each sub-control in response to the completion of the measurement space division; the initial text size is the maximum text size that can be displayed in the measurement space; and a size adjustment module, used to modify the text size of each sub-control to the minimum text size among the initial text sizes.

[0012] A third aspect of the present invention provides an electronic device comprising: one or more processors; and a memory for storing one or more programs, wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the adaptive layout method described above.

[0013] A fourth aspect of the present invention also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the above-described adaptive layout method.

[0014] The adaptive layout method provided by this invention adjusts the font size of all subspaces in one go by listening to the nodes after the measurement space is divided. This at least partially solves the problems of incomplete text display, visual inconsistency, low space utilization and high performance overhead in the prior art. It provides an adaptive mechanism that can dynamically calculate and unify the font size of all subspaces after the layout is completed. Attached Figure Description

[0015] Figure 1 A flowchart illustrating an adaptive layout method provided in an embodiment of the present invention;

[0016] Figure 2 This is a flowchart illustrating the key operations of an SRG control provided in an embodiment of the present invention.

[0017] Figure 3 A sequence diagram of an adaptive layout method provided in an embodiment of the present invention;

[0018] Figure 4 A structural block diagram of an adaptive layout system provided in an embodiment of the present invention;

[0019] Figure 5This is a structural block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0020] To enable those skilled in the art to better understand the technical solutions of the present invention, exemplary embodiments of the present invention are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0021] Where there is no conflict, the various embodiments of the present invention and the features thereof may be combined with each other.

[0022] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.

[0023] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Terms such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.

[0024] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having the meaning consistent with their meaning in the context of the relevant art and the invention, and will not be interpreted as having an idealized or overly formal meaning unless expressly so defined herein.

[0025] In the technical solution of this invention, the collection, storage, use, processing, transmission, provision, and disclosure of user personal information all comply with relevant laws and regulations and do not violate public order and good morals. The use of user data in this technical solution follows relevant national laws and regulations (e.g., the "Information Security Technology - Personal Information Security Specification"). For example: appropriate measures are taken for personal information access control; restrictions are imposed on the display of personal information; the purpose of using personal information does not exceed the scope of direct or reasonable association; and explicit identity targeting is eliminated when using personal information to avoid precisely locating a specific individual.

[0026] To alleviate issues like text truncation, overlap, or layout misalignment that can occur when option text lengths vary significantly, one improvement is to utilize Android's system to provide automatic text scaling for individual TextViews. However, this approach relies on each option making independent scaling decisions based on its own available space, lacking a unified management mechanism. This results in inconsistent font sizes for options within the same group, failing to guarantee font size consistency across multiple options. For example, one option might be scaled to 12sp while another is scaled to 14sp, leading to visual inconsistency. While ensuring the complete display of individual options, it sacrifices overall visual consistency, as inconsistent font sizes negatively impact the interface's aesthetics. Alternatively, to accommodate the longest text, all controls could be sized according to the maximum font size, resulting in wasted space.

[0027] Another common practice is for developers to completely customize the layout. For example, during the view's measurement or layout phase, they might iterate through child controls, pre-calculate the total width of all text, and attempt to dynamically adjust the font size to fit the available space. However, this method has significant performance risks. Pre-calculating the total width of all text and dynamically adjusting the font size during the onMeasure phase can easily lead to multiple loop calls in the measurement and layout process, causing delays and stuttering in UI rendering. Furthermore, even minor calculation errors can result in multiple measurements (multiple calls to onMeasure), leading to performance issues and layout jitter. Additionally, such custom calculation logic is complex, requiring consideration of various factors such as font measurement, padding, and margins, resulting in high code maintenance costs and difficulty in ensuring consistent display across different screen densities and language environments.

[0028] To address at least one of the technical problems existing in the aforementioned related technologies, the present invention provides an adaptive layout method. Figure 1 This is a flowchart illustrating an adaptive layout method provided in an embodiment of the present invention. The adaptive layout method includes: dividing a measurement space for child controls according to their weights; in response to the completion of the measurement space division, obtaining an initial text size for each child control; the initial text size being the maximum text size that can be displayed in the measurement space; and modifying the text size of each child control to the minimum text size among the initial text sizes.

[0029] Through embodiments of the present invention, the actual rendering size that can fully display the text among all options is obtained by traversing the data, and the minimum value is taken. This minimum value (minFontSize) is the largest uniform font that ensures the complete display of all text for all options. This method is simple and efficient, achieving the two goals of ensuring complete display and visual uniformity; by monitoring the time point when the measurement space division is completed, the text size is adjusted only after the initial layout of the sub-controls is determined, ensuring that the adjustment is completed in one step, saving computing power.

[0030] Based on the above embodiments, the measurement space for child controls is divided according to their weights, including: obtaining custom attributes; the custom attributes include at least one of the following: layout direction, number of grid rows and columns, initial text size, text size range, and child control margins; in response to the child controls being arranged linearly, the measurement space of the child controls is calculated based on the layout direction, child control weights, child control margins, and page size; in response to the child controls being arranged in a grid, the measurement space of the child controls is calculated based on the number of grid rows and columns, child control weights, child control margins, and page size.

[0031] In this embodiment, during the initialization phase, in the constructor, custom attributes (such as initial font size, maximum / minimum font range, margins, etc.) are obtained through TypedArray (a type array or typed view, a set of array-like views used to manipulate fixed-length, specific-type binary data in a byte container) and the corresponding initialization settings are performed.

[0032] Through the embodiments of the present invention, it supports scenarios such as horizontal and vertical layouts, multiple languages, and high-density screens, without the need to manually write a large amount of conditional judgment code, automatically adapts to different text lengths and device sizes, and has strong compatibility; it uses custom attribute constraints to ensure that the layout meets user needs.

[0033] Based on the above embodiment, the sub-control is a radio button.

[0034] In this embodiment, when the child control is a radio button, it is a linear layout of a single column or row. In the layout measurement phase (onMeasure), the onMeasure method is overridden. First, the parent class method is called, and then the total width or height of all child RBs (Radio Buttons) is calculated according to the layout direction (horizontal / vertical). The width or height is then evenly or weighted according to the available space, and a preliminary measurement space is set for each RB.

[0035] Through embodiments of this disclosure, compatibility with native system functions and interactive behaviors is achieved by inheriting standard containers (such as RelativeLayout / RadioGroup) and managing the properties of child controls (such as disabling their independent auto-scaling function AUTO_SIZE_TEXT_TYPE_NONE and uniformly setting the text size setTextSize()).

[0036] Based on the above embodiments, in response to the completion of the measurement space division, the initial text size is obtained for each child control. Prior to this, a global layout listener is registered to detect whether the measurement space division is complete.

[0037] In this embodiment, the `onLayout` method is overridden to perform normal child view layout operations. Within this method, a global layout listener (`ViewTreeObserver.OnGlobalLayoutListener`) is registered, which is crucial for triggering adaptive adjustments. This ensures that the adjustment operation is executed only once after the layout is complete, avoiding circular calls.

[0038] This invention provides a collaborative adaptive mechanism based on a global layout listener. Existing solutions often attempt adjustments during the measurement or layout phase, while this invention proposes to perform unified font adjustments after the system has completed the layout of the entire view tree (i.e., after the `onLayout` method has finished executing, used to determine the position and size of a View within its parent container; when a View is added to the parent container or the size of the parent container changes, the system calls this method to rearrange the View). This timing ensures that the size and position of all child views are in their final state, and the text rendering size obtained based on this is the most accurate and reliable basis, guaranteeing the one-time and accurate adjustment, fundamentally avoiding performance issues and layout errors.

[0039] Based on the above embodiments, the text size of each child control is modified to the minimum text size among the initial text sizes, and then the global layout listener is removed.

[0040] Through the embodiments of the present invention, after the font is uniformly adjusted, the listener is immediately removed, ensuring that the entire adaptive process is executed precisely only once when the initial layout is completed, and is not triggered again thereafter.

[0041] Based on the above embodiments, for each child control, the initial text size is obtained, including: traversing all subviews and filtering out child control instances; obtaining the text size rendered by each child control under the current measurement space conditions.

[0042] Through embodiments of the present invention, all subviews within a container are inspected, and only the target that needs to be processed, such as RadioButton, is selected.

[0043] Based on the above embodiments, the text size of each child control is modified to the minimum text size among the initial text sizes, including: comparing the initial text sizes of the child controls and determining the minimum text size; disabling the original auto-scaling property of the child controls; and uniformly setting the text size of the child controls to the minimum text size.

[0044] In this embodiment, within the global layout listener and the `onGlobalLayout` callback, all child views are iterated through, and RadioButton instances are selected. For each RB, the `getTextSize()` method is called to obtain the actual pixel size of its text rendered under the current measurement and layout conditions. The system may have automatically scaled the text during the layout process; this value reflects the maximum size of the text that can be fully displayed. The actual text sizes of all RBs are compared, and the minimum value (`minFontSize`) is found. This value is the maximum uniform font size that ensures all option text can be fully displayed under the current layout. The original auto-scaling properties of each RB are disabled (e.g., `setAutoSizeTextTypeWithDefaults(TextView.AUTO_SIZE_TEXT_TYPE_NONE)`), and then the text size of all RBs is uniformly set to `minFontSize`. Finally, the global layout listener is removed to prevent duplicate execution.

[0045] Through embodiments of the present invention, layout jitter is prevented by disabling the original automatic scaling attribute; and incomplete and inconsistent display is prevented by setting all text to the minimum size.

[0046] Figure 2 This is a flowchart illustrating the key operations of an SRG (Selection Radio Group) control provided in an embodiment of the present invention. It outlines the key workflow of the SRG control, including four core stages: initialization, measurement, layout, and adaptive adjustment. Figure 2 As shown, this invention provides a custom Android control called SelectionRadioGroup (SRG), which inherits from RelativeLayout (or RadioGroup). By overriding key lifecycle methods and introducing a global layout listener, it achieves coordinated and adaptive adjustment of the font size of all child RadioButtons. Its core lies in calculating the maximum uniform font size (i.e., the minimum rendering font) that allows all options to display their text completely after the layout is completed.

[0047] Figure 3 This is a sequence diagram illustrating an adaptive layout method provided in an embodiment of the present invention. The diagram shows the collaboration order of key methods within the SRG after receiving a system layout request, highlighting the timing of adaptive adjustments. For example... Figure 3 As shown in the sequence diagram, this clearly illustrates the complete workflow of the adaptive radio button group (SelectionRadioGroup) control described in this invention. Its execution begins with the standard layout process initiated by the system: first, the onMeasure() method is called to perform initial measurements, and the container allocates preliminary measurement space to each child radio button based on its weight and layout direction; then, the onLayout() method is called to determine the final position of each child button based on the measurement results and complete its placement.

[0048] The key innovation of this invention lies in the behavior following the standard process described above. During the layout phase, the container registers a global layout listener. As shown in the figure, after the system completes all layout work for the entire view tree, the onGlobalLayout() callback is triggered asynchronously. It is precisely at this crucial moment when the layout is completely finished that this invention begins to execute its core adaptive adjustment logic. The container iterates through all child buttons, obtaining the actual rendering size of each button within its final defined space to fully display the text; then, by comparison, it finds the minimum value among these sizes, which is the maximum uniform font size that ensures all option text is fully displayed; finally, this uniform font size is synchronously applied to all child buttons.

[0049] Figure 4 A structural block diagram of an adaptive layout system provided in an embodiment of the present invention is shown below. Figure 4 As shown, the present invention provides an adaptive layout system that can be used to implement the above-mentioned adaptive layout method, including: a preliminary division module, used to divide the measurement space for the sub-controls according to the layout direction and weight; a size acquisition module, used to acquire the initial text size for each sub-control in response to the completion of the measurement space division; the initial text size is the maximum text size that can be displayed in the measurement space; and a size adjustment module, used to modify the text size of each sub-control to the minimum text size among the initial text sizes.

[0050] According to embodiments of this disclosure, any plurality of modules in an adaptive placement system can be merged into one module, or any one of the modules can be split into multiple modules. Alternatively, at least a portion of the functionality of one or more of these modules can be combined with at least a portion of the functionality of other modules and implemented in one module. According to embodiments of this disclosure, at least one of the adaptive placement systems can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuitry, or implemented in any one of software, hardware, and firmware, or in a suitable combination of any of these. Alternatively, at least one of the adaptive placement systems can be at least partially implemented as a computer program module, which, when run, can perform corresponding functions.

[0051] Based on the same inventive concept, embodiments of the present invention also provide an electronic device. Figure 5 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. Figure 5 As shown, an embodiment of the present invention provides an electronic device including: one or more processors 101, a memory 102, and one or more I / O interfaces 103. The memory 102 stores one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement any of the adaptive layout methods described in the above embodiments; the one or more I / O interfaces 103 are connected between the processor and the memory, configured to enable information interaction between the processor and the memory.

[0052] The processor 101 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the memory 102 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), and flash memory (FLASH); the I / O interface (read / write interface) 103 is connected between the processor 101 and the memory 102, and can realize information interaction between the processor 101 and the memory 102, including but not limited to a data bus (Bus).

[0053] In some embodiments, the processor 101, memory 102, and I / O interface 103 are interconnected via bus 104, and thus connected to other components of the computing device.

[0054] In some embodiments, the one or more processors 101 include a field-programmable gate array.

[0055] This invention also provides a computer-readable medium. The computer-readable medium stores a computer program, which, when executed by a processor, implements the steps of any of the adaptive layout methods described in the above embodiments. The computer-readable storage medium may be volatile or non-volatile.

[0056] This invention also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in the processor of an electronic device, the processor in the electronic device executes the above-described adaptive layout method.

[0057] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).

[0058] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable program instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0059] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0060] The computer program instructions used to perform the operations of this invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the computer-readable program instructions. This electronic circuitry can execute the computer-readable program instructions to implement various aspects of the invention.

[0061] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0062] Various aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should 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-readable program instructions.

[0063] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0064] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0065] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0066] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in conjunction with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in conjunction with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of the invention as set forth in the appended claims.

Claims

1. An adaptive layout method, characterized in that, include: The measurement space is divided according to the weight of the sub-controls; In response to the completion of the measurement space division, the initial text size is obtained for each sub-control; the initial text size is the maximum text size that the measurement space can display; Modify the text size of each child control to the smallest of the initial text sizes.

2. The method according to claim 1, wherein, The process of dividing the measurement space for sub-controls according to weights includes: Obtain custom attributes; the custom attributes include at least one of the following: layout direction, number of grid rows and columns, initial text size, text size range, and child control margins; In response to the linear arrangement of child controls, the measurement space of the child controls is calculated based on the layout direction, child control weight, child control margin, and page size. In response to a grid arrangement of child controls, the measurement space of the child controls is calculated based on the number of grid rows and columns, the weight of the child controls, the margins of the child controls, and the page size.

3. The method according to claim 2, wherein, The sub-control is a radio button.

4. The method according to claim 1, wherein, In response to the completion of the measurement space division, the initial text size is obtained for each child control, which also includes: Register a global layout listener to detect whether the measurement space has been divided.

5. The method according to claim 4, wherein, The step of modifying the text size of each child control to the smallest of the initial text sizes also includes: Remove the global layout listener.

6. The method according to claim 1, wherein, The process of obtaining the initial text size for each child control includes: Iterate through all subviews and filter out the child control instances; Get the text size rendered for each child control under the current measurement space conditions.

7. The method according to claim 1, wherein, The step of modifying the text size of each child control to the smallest of the initial text sizes includes: Compare the initial text sizes of the child controls to determine the smallest text size; Disable the original auto-scaling property of the child control; Set the text size of all child controls to the minimum text size specified above.

8. An adaptive layout system, characterized in that, Capable of implementing the method as described in any one of claims 1 to 7, comprising: The initial partitioning module is used to divide the measurement space for child controls based on the layout direction and weight. The size acquisition module is used to acquire the initial text size for each sub-control in response to the completion of the measurement space division; the initial text size is the maximum text size that can be displayed in the measurement space; The size adjustment module is used to modify the text size of each child control to the smallest of the initial text sizes.

9. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1 to 7.

10. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.