User interface generation method and device, electronic equipment and storage medium
By creating user interfaces using a declarative programming paradigm, and utilizing extension functions and interface context objects to generate the interface layout of view groups and view objects, the problem of developers switching between XML and Java code is solved, improving development efficiency and code readability.
Patent Information
- Application Number
- CN202310565127.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-18
- Publication Date
- 2024-11-22
AI Technical Summary
In the current technology, during the user interface development process, developers need to switch back and forth between XML files and Java business code, which leads to low efficiency and high cost. In addition, the performance overhead brought by the reflection mechanism affects development efficiency and maintainability.
It adopts a declarative programming paradigm, creating view groups and view object layouts through extension functions and interface context objects, avoiding developers switching back and forth between XML files and Java business code, and directly manipulating view objects for interface layout and rendering.
It improves the efficiency of user interface development and code readability, reduces development costs, and enhances the maintainability of the interface layout.
Smart Images

Figure CN119002906A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for generating a user interface. Background Art
[0002] Currently, electronic devices can provide a user interface (UI) for interacting with users, which includes visual interface elements such as pictures, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc.
[0003] In the related technology, during the user interface development process, developers are required to use XML (Extensible Markup Language) files to describe the UI and layout, and use Java business codes to control the UI and layout. Developers need to switch back and forth between XML files and Java business codes, causing certain interruptions. On the other hand, there are differences in the types of XML files and Java business codes. Developers need to write certain glue codes to implement binding and information exchange between the two. In addition, this method requires the use of reflection to implement the construction of UI and layout, which brings certain performance overhead, resulting in low efficiency and high cost of user interface development. Summary of the invention
[0004] Based on this, the purpose of the present application is to provide a user interface generation method, device, electronic device and storage medium, which have the advantage of improving the efficiency of developing user interfaces.
[0005] According to a first aspect of an embodiment of the present application, a method for generating a user interface is provided, comprising the following steps:
[0006] Creating an interface layout of the first view group based on the first extension function, the interface context object, and the layout properties of the first view group;
[0007] Creating an interface layout of the second view group based on the second extension function, the interface context object, and the layout properties of the second view group;
[0008] Based on the third extension function, the interface context object and the properties of the second view, create a plurality of second view objects;
[0009] A plurality of second view objects are nested into the interface layout of the second view group, and the interface layout of the second view group is nested into the interface layout of the first view group to generate a user interface.
[0010] According to a second aspect of an embodiment of the present application, there is provided a user interface generating device, including:
[0011] A first interface layout creation module, used to create an interface layout of the first view group based on the first extension function, the interface context object and the layout attribute of the first view group;
[0012] A second interface layout creation module, used to create an interface layout of the second view group based on the second extension function, the interface context object and the layout properties of the second view group;
[0013] A view object creation module, used to create a plurality of second view objects based on the third extension function, the interface context object and the properties of the second view;
[0014] The user interface generation module is used to nest a plurality of second view objects into the interface layout of the second view group, and nest the interface layout of the second view group into the interface layout of the first view group to generate a user interface.
[0015] According to a third aspect of an embodiment of the present application, there is provided an electronic device, comprising: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing any one of the user interface generation methods described above.
[0016] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for generating a user interface as described above is implemented.
[0017] The embodiment of the present application creates the interface layout of the first view group based on the first extension function, the interface context object and the layout attributes of the first view group; creates the interface layout of the second view group based on the second extension function, the interface context object and the layout attributes of the second view group; creates several second view objects based on the third extension function, the interface context object and the attributes of the second view; nests several second view objects into the interface layout of the second view group, and nests the interface layout of the second view group into the interface layout of the first view group to generate a user interface. The present application creates the interface layout of the first view group, the interface layout of the second view group and the second view object through the extension function, without the need for developers to switch back and forth between XML files and Java business codes, thereby improving the efficiency of developing user interfaces. At the same time, the interface layout is performed based on the declarative programming paradigm, thereby improving the code readability of developing user interfaces.
[0018] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application.
[0019] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A flowchart of a method for generating a user interface provided in the first embodiment of the present application;
[0021] Figure 2 A structural block diagram of a user interface generating device provided in a second embodiment of the present application;
[0022] Figure 3 This is a schematic block diagram of the structure of an electronic device provided in the third embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to make the objectives, technical solutions and advantages of the present application more clear, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
[0024] It should be clear that the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0025] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the embodiments of the present application. The singular forms of "a", "" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more associated listed items.
[0026] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims. In the description of the present application, it should be understood that the terms "first", "second", "third", etc. are only used to distinguish similar objects, and do not have to be used to describe a specific order or sequence, nor can they be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances.
[0027] In addition, in the description of this application, unless otherwise specified, "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0028] In order to better understand the design scheme of this application, some user interface generation methods in the technology are explained below.
[0029] In the related art, during the user interface development process, one solution requires developers to use XML (Extensible Markup Language) files to describe UI and layout, and use Java business code to control UI and layout. Developers need to switch back and forth between XML files and Java business codes, which causes certain interruptions. On the other hand, there are differences in the types of XML files and Java business codes. Developers need to write certain glue codes to achieve binding and information exchange between the two. In addition, this method requires the use of reflection to implement the construction of UI and layout, which brings certain performance overhead, resulting in low efficiency and high cost of user interface development. Another solution is to use code control flow to construct UI and layout. Specifically, directly in Java business code, UI and layout are constructed through control flow programming, which has poor readability and affects maintainability.
[0030] To this end, an embodiment of the present application proposes a user interface generating method.
[0031] The user interface generation method provided in the embodiment of the present application is based on the declarative programming paradigm for UI construction and layout, and uses the declarative programming paradigm to describe the view hierarchy and view layout of the UI. Compared with the traditional imperative programming paradigm, which issues instructions and directly operates view objects, the declarative programming paradigm is to operate the description of view objects, parse and read the declarations of these view objects, and draw and render in a manner corresponding to the declaration to generate a user interface. Compared with the imperative programming paradigm, the readability and maintainability of the code are improved.
[0032] The user interface generation method provided in the embodiment of the present application can be executed by a user interface generation device, and the user interface generation device can be implemented by software and / or hardware. The user interface generation device can be composed of two or more physical entities or one physical entity.
[0033] The user interface generation device may include one or more processing cores, which may implement the user interface generation method of the present application in a pure software manner, or in a combination of software and hardware, such as in a digital signal processing, field programmable gate array, programmable logic array, or in a hardware form; or may integrate a central processing unit, an image processor, a modem, or a combination of one or more of the above. The training device may run an application program having an exhaustion protection method for the training device, and the application program may be presented in a form adapted to the training device, such as an APP application program. In some examples, it may also be presented in the form of a system plug-in, a web page plug-in, or the like.
[0034] Example 1
[0035] See also Figure 1 , Figure 1 A flowchart of a method for generating a user interface provided in the first embodiment of the present application is provided. The method includes the following steps:
[0036] S10: Creating an interface layout of the first view group based on the first extension function, the interface context object, and the layout properties of the first view group.
[0037] Among them, the extension function is an extension function of the Kotlin development language. You can use the extension function to add a new function to a class without directly defining the function in the class. The extension function can extend the functionality of an existing class without modifying the class definition. And in the function body, you can omit the receiver object of the function, making the code more concise and readable.
[0038] The interface context object is the Activity Context object. The interface context (Activity Context) is created when the application interface (Activity) is started, and is mainly used to save references to the current interface resources. When you need to create the interface layout or controls of the interface, you need to use the interface context.
[0039] The first view group is used to accommodate the second view group, and the layout attributes of the first view group are used to indicate the position information of the second view group in the first view group. The layout attributes of the first view group include the interface layout direction of the first view group and the alignment of the second view group in the interface layout of the first view group. Among them, the interface layout direction of the first view group includes the horizontal layout direction and the vertical layout direction, and the alignment includes left alignment, right alignment, center alignment, etc.
[0040] The interface layout of the first view group may include, but is not limited to, a relative layout, a linear layout, a frame layout, a table layout, and a grid layout.
[0041] In the embodiment of the present application, the first extension function is executed, the interface context object and the layout properties of the first view group are passed into the first extension function as function parameters, and the interface layout of the first view group is created.
[0042] S20: Creating an interface layout of the second view group based on the second extension function, the interface context object, and the layout properties of the second view group.
[0043] The second view group is used to accommodate a plurality of second view objects, and the layout attributes of the second view group are used to indicate the position information of the plurality of second view objects in the interface layout of the second view group. The layout attributes of the second view group include the interface layout direction of the second view group and the alignment of the second view objects in the interface layout of the second view group. The interface layout direction of the second view group includes a horizontal layout direction and a vertical layout direction, and the alignment includes left alignment, right alignment, center alignment, etc.
[0044] The interface layout of the second view group may include, but is not limited to, a relative layout, a linear layout, a frame layout, a table layout, and a grid layout.
[0045] In the embodiment of the present application, the second extension function is executed, the interface context object and the layout properties of the second view group are passed into the second extension function as function parameters, and the interface layout of the second view group is created.
[0046] S30: Creating a plurality of second view objects based on the third extension function, the interface context object and the properties of the second view.
[0047] The attributes of the second view are used to indicate the type, color, content, ID, width and height of the second view object, etc. The second view object includes but is not limited to a text object, a button object, and a picture object, etc.
[0048] In the embodiment of the present application, the third extension function is executed, and the interface context object and the properties of the second view are passed into the third extension function as function parameters to create the second view object.
[0049] S40: nesting a plurality of second view objects into the interface layout of the second view group, and nesting the interface layout of the second view group into the interface layout of the first view group, to generate a user interface.
[0050] In an embodiment of the present application, a plurality of second view objects are nested into the interface layout of the second view group according to the interface layout direction of the second view group and the alignment of each second view object in the interface layout of the second view group, and the second view group is nested into the interface layout of the first view group according to the interface layout direction of the first view group and the alignment of the second view group in the interface layout of the first view group, to generate a user interface.
[0051] By using the embodiment of the present application, the interface layout of the first view group is created based on the first extension function, the interface context object and the layout attributes of the first view group; the interface layout of the second view group is created based on the second extension function, the interface context object and the layout attributes of the second view group; a plurality of second view objects are created based on the third extension function, the interface context object and the attributes of the second view; the plurality of second view objects are nested into the interface layout of the second view group, and the interface layout of the second view group is nested into the interface layout of the first view group to generate a user interface. The present application creates the interface layout of the first view group, the interface layout of the second view group and the second view object through the extension function, without the need for developers to switch back and forth between XML files and Java business codes, thereby improving the efficiency of developing user interfaces. At the same time, the interface layout is performed based on the declarative programming paradigm, thereby improving the code readability of developing user interfaces.
[0052] In an optional embodiment, step S10 includes steps S11 to S12, which are specifically as follows:
[0053] S11: creating an interface layout class of a first view group through a first extension function;
[0054] S12: Execute the first extension function, pass the interface context object and the layout properties of the first view group as function parameters to the first extension function, instantiate the interface layout class of the first view group, and obtain the interface layout of the first view group.
[0055] In the embodiment of the present application, the first extension function is used to create an interface layout class of the first view group, and the interface layout class of the first view group is used to indicate the specific placement position of the first view group in the user interface. By assigning the interface context object and the layout properties of the first view group to the interface layout class of the first view group, and instantiating the interface layout class of the first view group, the interface layout of the first view group can be automatically and quickly obtained.
[0056] In an optional embodiment, step S20 includes steps S21 to S22, which are specifically as follows:
[0057] S21: creating an interface layout class of a second view group through a second extension function;
[0058] S22: Execute the second extension function, pass the interface context object and the layout properties of the second view group as function parameters to the second extension function, instantiate the interface layout class of the second view group, and obtain the interface layout of the second view group.
[0059] In the embodiment of the present application, the second extension function is used to create an interface layout class of the second view group, and the interface layout class of the second view group is used to indicate the specific placement position of the second view in the interface layout of the second view group. By assigning the interface context object and the layout attributes of the second view group to the interface layout class of the second view group, and instantiating the interface layout class of the second view group, the interface layout of the second view group can be automatically and quickly obtained.
[0060] In an optional embodiment, before step S30, steps S31 to S32 are included, which are specifically as follows:
[0061] S31: Create image objects based on top-level functions;
[0062] S32: Acquire parameters of the image object, and use the parameters of the image object as attributes of the second view.
[0063] Among them, the top-level function means that in Kotlin, the function can be placed directly at the top level of the code file without belonging to any class. When accessing the function outside the package, you can directly import the path of the function.
[0064] In the embodiment of the present application, an image object can be created through a top-level function. Specifically, the image object is a Drawable object, and the parameters of the image object are used as attributes of the second view and passed to the third extension function to set the geometric shape of the second view object.
[0065] In an optional embodiment, before step S30, steps S33 to S34 are included, which are specifically as follows:
[0066] S33: Get resource management object;
[0067] S34: extracting a resource identifier from the resource management object, indexing a corresponding resource according to the resource identifier, and using the resource parameters as attributes of the second view.
[0068] Among them, the resource management object is used to indicate the basic resources required for the program to run. Specifically, the resource management object can be obtained through the global application context. The global application context consists of the main architecture and main event loop of the system loaded by the main function and global data, which can be stored in a global static variable for global access.
[0069] Resource identifiers are used to uniquely identify resources, which can be images, text, etc. Resource parameters include image content, text content, etc.
[0070] In the embodiment of the present application, the resource parameters can be used as attributes of the second view and passed to the third extension function, so that the content of the second view object can be set.
[0071] In an optional embodiment, step S30 includes steps S35 to S36, which are specifically as follows:
[0072] S35: creating a second view class through the third extension function;
[0073] S36: Execute the second extension function, pass the interface context object and the properties of the second view as function parameters to the third extension function, instantiate the second view class object, and obtain the second view object.
[0074] In the embodiment of the present application, the third extension function is used to create a second view class, and the second view class is used to indicate the properties of the second view. By assigning the interface context object and the properties of the second view to the second view class, the second view class is instantiated, and the second view object can be automatically and quickly obtained.
[0075] In an optional embodiment, step S40 includes steps S41 to S44, which are specifically as follows:
[0076] S41: drawing each second view object into an interface element to be displayed;
[0077] S42: Determine, according to the interface layout of the second view group, that the interface element to be displayed is located at a first layout position of the second view group;
[0078] S43: determining, according to the interface layout of the first view group, that the second view group is located at a second layout position of the first view group;
[0079] S44: Rendering the interface elements to be displayed according to the first layout position and the second layout position to generate a user interface.
[0080] The interface elements to be displayed include but are not limited to text controls, image controls, and button controls.
[0081] In the embodiment of the present application, there is a nested relationship between the interface layout of the second view object and the second view group. According to the nested relationship, the second interface element to be displayed corresponding to the second view object is placed in the first layout position of the second view group. There is a nested relationship between the interface layout of the second view group and the interface layout of the first view group. According to the nested relationship, the second view group is placed in the second layout position of the first view group. According to the first layout position and the second layout position, the interface element to be displayed is rendered to generate a user interface, thereby avoiding nesting errors caused by the nesting of the interface elements to be displayed and improving the accuracy of generating the user interface.
[0082] Example 2
[0083] The following is an embodiment of the device of the present application, which can be used to execute the content of the method in Embodiment 1 of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the content of the method in Embodiment 1 of the present application.
[0084] See also Figure 2 , which shows a schematic diagram of the structure of a user interface generating device provided in a second embodiment of the present application. The user interface generating device 5 provided in an embodiment of the present application includes:
[0085] A first interface layout creation module 51, used to create an interface layout of the first view group based on the first extension function, the interface context object and the layout attribute of the first view group;
[0086] A second interface layout creation module 52, used to create an interface layout of the second view group based on the second extension function, the interface context object and the layout attribute of the second view group;
[0087] A view object creation module 53, used to create a plurality of second view objects based on the third extension function, the interface context object and the properties of the second view;
[0088] The user interface generation module 54 is used to nest a plurality of second view objects into the interface layout of the second view group, and nest the interface layout of the second view group into the interface layout of the first view group, to generate a user interface.
[0089] By using the embodiment of the present application, the interface layout of the first view group is created based on the first extension function, the interface context object and the layout attributes of the first view group; the interface layout of the second view group is created based on the second extension function, the interface context object and the layout attributes of the second view group; a plurality of second view objects are created based on the third extension function, the interface context object and the attributes of the second view; the plurality of second view objects are nested into the interface layout of the second view group, and the interface layout of the second view group is nested into the interface layout of the first view group to generate a user interface. The present application creates the interface layout of the first view group, the interface layout of the second view group and the second view object through the extension function, without the need for developers to switch back and forth between XML files and Java business codes, thereby improving the efficiency of developing user interfaces. At the same time, the interface layout is performed based on the declarative programming paradigm, thereby improving the code readability of developing user interfaces.
[0090] Optionally, the first interface layout creation module includes:
[0091] A first interface layout class creating unit, used to create an interface layout class of a first view group through a first extension function;
[0092] The first interface layout obtaining unit is used to execute the first extension function, pass the interface context object and the layout properties of the first view group as function parameters to the first extension function, instantiate the interface layout class of the first view group, and obtain the interface layout of the first view group.
[0093] Optionally, the second interface layout creation module includes:
[0094] A second interface layout class creating unit, used to create an interface layout class of a second view group through a second extension function;
[0095] The second interface layout obtaining unit is used to execute the second extension function, pass the interface context object and the layout properties of the second view group as function parameters to the second extension function, instantiate the interface layout class of the second view group, and obtain the interface layout of the second view group.
[0096] Optionally, a view object creation module, including:
[0097] A second view class creating unit, used for creating a second view class through a third extension function;
[0098] The second view object obtaining unit is used to execute the second extension function, pass the interface context object and the properties of the second view as function parameters to the third extension function, instantiate the second view class object, and obtain the second view object.
[0099] Optional, user interface generation module, including:
[0100] An interface element drawing unit, used for drawing each second view object into an interface element to be displayed;
[0101] A first layout position determining unit, configured to determine, according to the interface layout of the second view group, that the interface element to be displayed is located at a first layout position of the second view group;
[0102] A second layout position determining unit, configured to determine, according to the interface layout of the first view group, that the second view group is located at a second layout position of the first view group;
[0103] The user interface generation unit is used to render the interface elements to be displayed according to the first layout position and the second layout position to generate a user interface.
[0104] Example 3
[0105] The following is an embodiment of the device of the present application, which can be used to execute the contents of the method in Embodiment 1 and Embodiment 2 of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the contents of the method in Embodiment 1 and Embodiment 2 of the present application.
[0106] See also Figure 3 The present application also provides an electronic device 300, which may be a computer, a mobile phone, a tablet computer, etc. In an exemplary embodiment of the present application, the electronic device 300 is a mobile phone, which includes: at least one processor 301, at least one memory 302, at least one display, at least one network interface 303, a user interface 304, and at least one communication bus 305.
[0107] The user interface 304 is mainly used to provide an input interface for the user and obtain data input by the user. Optionally, the user interface may also include a standard wired interface or a wireless interface.
[0108] The network interface 303 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0109] The communication bus 305 is used to realize the connection and communication between these components.
[0110] Among them, the processor 301 may include one or more processing cores. The processor uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions of the electronic device and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory, and calling data stored in the memory. Optionally, the processor can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor can integrate one or more combinations of central processing unit (Central Processing Unit, CPU), image processor (Graphics Processing Unit, GPU) and modem. Among them, the CPU mainly processes the operating system, user interface and application program, etc.; the GPU is responsible for rendering and drawing the content to be displayed by the display layer; the modem is used to process wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor, but implemented by a single chip.
[0111] Among them, the memory 302 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory includes a non-transitory computer-readable storage medium. The memory can be used to store instructions, programs, codes, code sets or instruction sets. The memory may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned method embodiments, etc.; the data storage area may store data involved in the above-mentioned method embodiments, etc. The memory may also be optionally at least one storage device located away from the aforementioned processor. As Figure 3 As shown, the memory as a computer storage medium may include an operating system, a network communication module, a user interface module, and an operating application program.
[0112] The processor can be used to call the application of the user interface generation method stored in the memory, and specifically execute the method steps of the above-mentioned embodiment 1. The specific execution process can refer to the specific description shown in embodiment 1, which will not be repeated here.
[0113] Example 4
[0114] The present application also provides a computer-readable storage medium on which a computer program is stored, and the instructions are suitable for being loaded by a processor and executing the method steps of the above-mentioned embodiment 1. The specific execution process can refer to the specific description shown in the embodiment, and will not be repeated here. The device where the storage medium is located can be a personal computer, a laptop computer, a smart phone, a tablet computer and other electronic devices.
[0115] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. The device embodiments described above are merely schematic, wherein the components described as separate parts may or may not be physically separated, and the parts displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.
[0116] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0117] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the function selected in the process. Figure 1 A process or multiple processes and / or boxes Figure 1function selected in a box or multiple boxes.
[0118] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 steps for the function selected in a box or multiple boxes.
[0119] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0120] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0121] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0122] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0123] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for generating a user interface, It is characterized in that The steps include: Creating an interface layout of the first view group based on the first extension function, the interface context object, and the layout properties of the first view group; Creating an interface layout of the second view group based on the second extension function, the interface context object, and the layout properties of the second view group; Based on the third extension function, the interface context object and the properties of the second view, create a plurality of second view objects; The plurality of second view objects are nested into the interface layout of the second view group, and the interface layout of the second view group is nested into the interface layout of the first view group to generate a user interface.
2. The user interface generation method according to claim 1, Features: The step of creating the interface layout of the first view group based on the first extension function, the interface context object and the layout attributes of the first view group includes: Create an interface layout class for the first view group through the first extension function; The first extension function is executed, the interface context object and the layout attributes of the first view group are passed into the first extension function as function parameters, the interface layout class of the first view group is instantiated, and the interface layout of the first view group is obtained.
3. The user interface generating method according to claim 1, Features: The step of creating the interface layout of the second view group based on the second extension function, the interface context object and the layout attributes of the second view group includes: Create an interface layout class for the second view group through the second extension function; The second extension function is executed, the interface context object and the layout attributes of the second view group are passed into the second extension function as function parameters, the interface layout class of the second view group is instantiated, and the interface layout of the second view group is obtained.
4. The method for generating a user interface according to claim 1, Features: The step of creating a plurality of second view objects based on the third extension function, the interface context object and the properties of the second view includes: Create the second view class through the third extension function; The second extension function is executed, and the interface context object and the properties of the second view are passed into the third extension function as function parameters, and the second view class is instantiated to obtain the second view object.
5. The method for generating a user interface according to claim 1, Features: The step of nesting the plurality of second view objects into the interface layout of the second view group, and nesting the interface layout of the second view group into the interface layout of the first view group, to generate a user interface includes: Drawing each of the second view objects into an interface element to be displayed; According to the interface layout of the second view group, determining that the interface element to be displayed is located at a first layout position of the second view group; According to the interface layout of the first view group, determining that the second view group is located at a second layout position of the first view group; The interface elements to be displayed are rendered according to the first layout position and the second layout position to generate a user interface.
6. The method for generating a user interface according to any one of claims 1 to 5, Features: Before the step of creating a plurality of second graph objects based on the third extension function, the interface context object and the properties of the second view, the method includes: Based on the top-level function, create an image object; Obtain parameters of the image object, and use the parameters of the image object as attributes of the second view.
7. The method for generating a user interface according to any one of claims 1 to 5, Features: Before the step of creating a plurality of second graph objects based on the third extension function, the interface context object and the properties of the second view, the method includes: Get the resource management object; A resource identifier is extracted from the resource management object, a corresponding resource is indexed according to the resource identifier, and a parameter of the resource is used as an attribute of the second view.
8. The method for generating a user interface according to any one of claims 1 to 5, Features: The interface layout of the first view group and / or the interface layout of the second view group includes but is not limited to a relative layout, a linear layout, a frame layout, a table layout and a grid layout.
9. The method for generating a user interface according to any one of claims 1 to 5, Features: The second view object includes but is not limited to a text object, a button object and a picture object.
10. A user interface generating device, It is characterized in that include: A first interface layout creation module, used to create an interface layout of the first view group based on the first extension function, the interface context object and the layout attribute of the first view group; A second interface layout creation module, used to create an interface layout of the second view group based on the second extension function, the interface context object and the layout properties of the second view group; A view object creation module, used to create a plurality of second view objects based on the third extension function, the interface context object and the properties of the second view; The user interface generation module is used to nest the plurality of second view objects into the interface layout of the second view group, and nest the interface layout of the second view group into the interface layout of the first view group to generate a user interface.
11. An electronic device, It is characterized in that include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the user interface generating method as described in any one of claims 1 to 9.
12. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the user interface generating method according to any one of claims 1 to 9 is implemented.
