Layout method of page view, storage medium and electronic device

By using methods such as hooking, inheritance, and overriding, the problem of customizable page layouts for non-self-developed pages has been solved, enabling flexible page layouts and improving the diversity of business development and user experience.

CN115543302BActive Publication Date: 2026-11-27SHANGHAI PATEO INTERNET TECH SERVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110728430.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-29
Publication Date
2026-11-27
Estimated Expiration
2041-06-29

AI Technical Summary

Technical Problem

Existing technologies cannot customize the layout of pages that are not custom-developed, making it difficult for business development to meet design requirements.

Method used

By using methods such as hooking, inheritance, and overriding, it is possible to customize the layout of pages provided by third-party SDKs or other non-self-developed pages, including defining the target page, setting the desired page, obtaining the view object, adding component elements, and determining the layout.

Benefits of technology

It enables custom layouts for pages that are not developed in-house, enhancing the diversity of business development and user interaction experience, and breaking through the limitations of fixed page layouts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115543302B_ABST
    Figure CN115543302B_ABST
Patent Text Reader

Abstract

The application provides a page view layout method, a storage medium and an electronic device. The page view layout method comprises the following steps: defining a target page; the target page refers to a page which needs to be modified in page layout; setting an expected page; the expected page is in an inheritance relationship with the target page; copying the target page to obtain a view object; adding the view object to the expected page; searching for a component element in the target page and adding the component element to the expected page; and determining the layout of the expected page according to the setting attributes of the view object and the component element. The application can customize and modify the layout of a non-self-developed page.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the technical field of page layout, and in particular relates to a page view layout method, storage medium, and electronic device. Background Technology

[0002] When developing a system, if you use a third-party SDK (Software Development Kit) or other pages that are not developed in-house, you often encounter a situation where the UI (User Interface) layout is fixed by the provider, making it impossible to modify it according to the designer's page requirements, or the modification process is very difficult.

[0003] For example, when a page is loaded, the view position and size of the page are fixed, and the position of a button on the page is also fixed. The button is located at the bottom of the page. According to the developer's business requirements, the button needs to be placed in the upper right corner of the page. In the existing technology, because the position of the button cannot be modified, it is difficult to implement the business development corresponding to this business requirement.

[0004] Therefore, how to provide a layout method, storage medium, and electronic device for page views to solve the shortcomings of existing technologies, such as the inability to customize the layout of non-self-developed pages, has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a layout method, storage medium and electronic device for page views, the advantage of which is that it can realize the customization of the layout of non-self-developed pages.

[0006] Another objective of this invention is to provide a page view layout method, storage medium, and electronic device, the advantage of which is that the page layout can be modified through methods such as hooking, inheritance, and overriding.

[0007] Another objective of this invention is to provide a page view layout method, storage medium, and electronic device. Its advantage is that it allows for the customization and modification of the layout of pages provided by third-party SDKs or other non-self-developed pages according to the developer's business needs, thus enabling business development to break through the limitations of fixed page layouts.

[0008] Another objective of this invention is to provide a page view layout method, storage medium, and electronic device, the advantage of which is that the flexible layout of the page enhances the diversity of the developed services and further improves the user's interaction and operation experience.

[0009] Another objective of this invention is to provide a page view layout method, storage medium, and electronic device, the advantage of which is that by setting two or more custom pages, the page layout methods are enriched, making the page layout more diverse and further meeting more business development needs.

[0010] To achieve the above and other related objectives, the present invention provides a page view layout method, the page view layout method comprising: defining a target page; the target page being a page whose layout needs to be modified; setting a desired page, wherein the desired page and the target page have an inheritance relationship; overriding the target page to obtain a view object; adding the view object to the desired page; finding component elements in the target page and adding the component elements to the desired page; and determining the layout of the desired page based on the set attributes of the view object and the component elements.

[0011] To achieve the above and other related objectives, another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the page view layout method described above.

[0012] To achieve the above and other related objectives, a final aspect of the present invention provides an electronic device, comprising: a processor and a memory; the memory for storing a computer program, and the processor for executing the computer program stored in the memory to cause the electronic device to perform the page view layout method. Attached Figure Description

[0013] Figure 1 The diagram shown is a flowchart illustrating the principle of the page view layout method of the present invention in one embodiment.

[0014] Figure 2 The diagram shows a modification of the page layout in one embodiment of the page view layout method of the present invention.

[0015] Figure 3 The diagram shows a desired page setup flowchart in one embodiment of the page view layout method of the present invention.

[0016] Figure 4 The flowchart shown is a target page rewriting process of the page view layout method of the present invention in one embodiment.

[0017] Figure 5 The flowchart shown is an example of an object addition process for a page view layout method of the present invention in one embodiment.

[0018] Figure 6 The flowchart shown is a component element addition process in one embodiment of the page view layout method of the present invention.

[0019] Figure 7 The diagram shown is a structural connection diagram of the electronic device of the present invention in one embodiment.

[0020] Component designation explanation

[0021] 7 Electronic devices

[0022] 71 processor

[0023] 72 Memory

[0024] 721 Random Access Memory

[0025] 722 cache memory

[0026] 723 Storage System

[0027] 724 Utilities

[0028] 725 Program Module

[0029] 73 bus

[0030] 74 External devices

[0031] 75 monitor

[0032] 76 I / O Interfaces

[0033] 77 Network Adapter

[0034] Steps S11 to S16

[0035] Steps S121~S122

[0036] Steps S131~S133

[0037] Steps S141~S142

[0038] Steps S151~S153 Detailed Implementation

[0039] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.

[0040] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the illustrations only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0041] The page view layout method, storage medium, and electronic device described in this invention can customize the layout of pages provided by third-party SDKs and other non-self-developed pages. Specifically, it achieves the purpose of modifying the UI layout through methods such as hooking, inheritance, and overriding. Here, hooking refers to a reverse learning method in Android or other systems, a way of calling or modifying function code. The functions involved in this invention for calling, overriding, or modifying code are APIs (Application Programming Interfaces) for setting view layouts.

[0042] The following will combine Figures 1 to 7 This paper elaborates on the principles and implementation methods of a page view layout method, storage medium, and electronic device according to this embodiment, so that those skilled in the art can understand the page view layout method, storage medium, and electronic device according to this embodiment without creative effort.

[0043] Please see Figure 1 The diagram shows a flowchart illustrating the principle of the page view layout method of the present invention in one embodiment. Figure 1 As shown, the layout method of the page view specifically includes the following steps:

[0044] S11, Define the target page; the target page refers to the page whose layout needs to be modified.

[0045] In one embodiment, the target page originates from a non-self-developed page whose layout has been modified according to business needs. For example, it could be a page provided by a third-party SDK.

[0046] In practical applications, taking the Android system as an example, the UI carrier page of Android is `andorid.app.Activity`; the API for setting the view layout in Android is `setContentView(View view)`, where the parameter `View` represents the view type, and `view` represents the view value. Based on the view type and view value, the defined target page can be determined.

[0047] S12, Set the desired page, wherein the desired page and the target page are in an inheritance relationship.

[0048] Specifically, a custom expected page B inherits from the target page A. Inheritance is a Java programming language operation, i.e., a parent-child class relationship. Expected page B and target page A have common attributes.

[0049] Please see Figure 2 The diagram shows a modification of the page layout in one embodiment of the page view layout method of the present invention.

[0050] like Figure 2 As shown, A represents the target page, M represents the page view of target page A, and W represents the component element of target page A; B represents the desired page, V represents the page view of target page B, M' represents the modified M added to V, and W' represents the modified W added to V.

[0051] Please see Figure 3 This is a flowchart illustrating the desired page setup process in one embodiment of the page view layout method of the present invention. Figure 3 As shown, S12 specifically includes the following steps:

[0052] S121, determine the creation requirements of the view of the desired page.

[0053] Specifically, creating requirements refers to the page requirements determined based on specific business needs, which may include the size, position, number, or other page view attributes.

[0054] S122, Based on the creation requirements, call the view creation interface to create the view of the desired page.

[0055] Specifically, the desired page view can be determined based on the size, position, number, or other page view attributes. Figure 2 The page view V shown.

[0056] S13, the target page is overwritten to obtain the view object.

[0057] Please see Figure 4 The above is a flowchart illustrating the target page replication process in one embodiment of the page view layout method of the present invention.

[0058] like Figure 4 As shown, S13 specifically includes the following steps:

[0059] S131, the method for creating view elements in the target page is overridden.

[0060] Specifically, in the expected page B, the `setContentView(View view)` method is overridden. The `setContentView(View view)` method of the target page A can only be called within the target page A. After the expected page B overrides the `setContentView(View view)` method, it possesses a `setContentView(View view)` method that it can call itself. Overriding is a Java programming language operation, where a method definition can be overridden. During the overriding process, common attributes between the target page A and the expected page B are retained, and new attributes specific to the expected page B are added. For example, a specific attribute could be `M'` in the expected page B.

[0061] S132, during the copying process, at least one of the following is modified: the size of the view element in the target page and the content to be presented.

[0062] Specifically, at least one of the following is modified: the size of the view element M in the target page A, and the content to be presented. The size refers to the dimensions of M, which are changed to the dimensions of M' after modification. The content to be presented refers to the component element information presented by the view element M. In the past, component element W was presented in M. After modification, component element W is no longer presented in M'. Therefore, the content to be presented changes after modification.

[0063] S133, the rewritten view element is used as the view object.

[0064] Specifically, after modifying the view element M in the target page A, it becomes the view object M' in the desired page B.

[0065] Furthermore, the dimensions of M include width and height, and the specific implementation process is as follows:

[0066] Set ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(width, height); then call Android's android.view.View.setLayoutParams(ViewGroup.LayoutParams params), which is M.setLayoutParam(layoutParams). This completes the size change of the view element M and generates a view object M' based on the new width and height.

[0067] S14, add the view object to the desired page.

[0068] Please see Figure 5The diagram shows a flowchart of object addition in one embodiment of the page view layout method of the present invention. Figure 5 As shown, S14 specifically includes the following steps:

[0069] S141, the position where the view object is added in the desired page is taken as the first addition position.

[0070] Specifically, the position where the view object M' is added in the desired page B is taken as the first addition position.

[0071] Furthermore, a custom view layout V for the desired page B is defined, such as a linear layout (android.widget.LinearLayout). This is achieved by calling the `setContentView(View view)` method in the Android UI host page `andorid.app.Activity`, thus creating the page view V for the desired page B. The first addition of position refers to determining the position of the view object M' within the linear layout V. In practical applications, this can be the coordinates of a point within V. Once these coordinates are determined, the view object M' is drawn using the point corresponding to those coordinates as the starting point, based on its width and height.

[0072] S142, call the first view addition function, and add the view object to the area specified by the first addition position according to the size and content of the overridden view object.

[0073] Specifically, the first view addition function is Android's android.view.ViewGroup.addView(View view), which adds the view object M' to the area specified by the first addition position.

[0074] S15, Locate the component element in the target page and add the component element to the desired page.

[0075] Please see Figure 6 The above is a flowchart of the component element addition process in one embodiment of the page view layout method of the present invention.

[0076] like Figure 6 As shown, S15 specifically includes the following steps:

[0077] S151, retrieve the executable file of the target page.

[0078] Specifically, the component element is a button (android.widget.Button), corresponding to Figure 2The text describes a process involving selecting the letter "W" and adjusting its position. It then retrieves the executable file "uiautomatorviewer.bat" from the Android SDK directory's "tools\bin\".

[0079] S152, search for the identification number corresponding to the component element in the execution file.

[0080] Specifically, find the unique ID (Identity Document, Unique Code) of button W in the tools\bin\uiautomatorviewer.bat executable file, where the ID identifies the attributes of W.

[0081] S153, delete the component element corresponding to the identification number in the target page, and add the component element corresponding to the identification number to the desired page.

[0082] In one embodiment, the unique ID of button W is used as an input parameter. The unique button W is found using the findViewById(id) method. Then, W is removed from the target page A and added to the desired page B using the android.view.ViewGroup.removeView(View view) method. The specific steps include:

[0083] (1) The position where the component element is added in the desired page is taken as the second addition position.

[0084] Specifically, the addition position of the component element W' in the page view V of the desired page B is taken as the second addition position.

[0085] (2) Call the second view addition function to add the component element to the area specified by the second addition position according to at least one of the component element's size and the content to be presented.

[0086] Specifically, the second view addition function is android.view.ViewGroup.addView(Viewview), which takes the type and value of W' as input parameters and adds W' to V through the android.view.ViewGroup.addView(View view) method.

[0087] It should be noted that the first view addition function and the second view addition function are actually the same function method, namely android.view.ViewGroup.addView(View view). They are defined as the first view addition function and the second view addition function because of different input parameters, in order to distinguish between different addition operations.

[0088] S16, determine the layout of the desired page based on the settings attributes of the view object and the component element.

[0089] Specifically, in combination Figure 2 As shown, the view object M' is located below the page view V, and the component element W' is located above the page view V. The layout of the desired page B is determined based on the position, size, and content of the view object M' and the component element W'.

[0090] In one embodiment, after step S16, the page view layout method further includes the following steps: setting two or more desired pages; and determining the overall layout of the page view by combining the layouts of all the desired pages.

[0091] Specifically, for target page A, expected page B and expected page C can be set. Expected page B and expected page C are displayed on the screen simultaneously. For example, expected page B can be a view object M' located below page view V and component element W' located above page view V. Expected page C can be a view object M' located above page view V and component element W' located below page view V.

[0092] The scope of protection for the page view layout method described in this invention is not limited to the execution order of the steps listed in this embodiment. Any solution implemented by adding, subtracting, or replacing steps in the prior art based on the principles of this invention is included within the scope of protection of this invention.

[0093] This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the layout method of the page view.

[0094] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented using computer program-related hardware. The aforementioned computer program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned computer-readable storage medium includes various computer storage media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0095] The present invention provides an electronic device, comprising: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to cause the electronic device to perform the page view layout method.

[0096] Please see Figure 7 The diagram shows a structural connection schematic of the electronic device of the present invention in one embodiment. Figure 7As shown, electronic device 7 is represented in the form of a general-purpose computing device. The components of electronic device 7 may include, but are not limited to: one or more processors 71, memory 72, and bus 73 connecting different system components (including processors 71 and memory 72).

[0097] Bus 73 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. Examples of these architectures include, but are not limited to, the ISA (Industry Standard Architecture) bus, the MCA (MicroChannel Architecture) bus, the enhanced ISA bus, the VESA (Video Electronics Standards Association) local bus, and the PCI (Peripheral Component Interconnect) bus.

[0098] Electronic device 7 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 7, including volatile and non-volatile media, removable and non-removable media.

[0099] Memory 72 may include computer system readable media in the form of volatile memory, such as RAM (Random Access Memory) 721 and / or cache memory 722. Electronic device 7 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 723 may be used to read and write non-removable, non-volatile magnetic media, commonly referred to as a "hard disk drive". Disk drives for reading and writing to removable non-volatile disks (e.g., "floppy disks") and optical disk drives for reading and writing to removable non-volatile optical disks, such as CD-ROM (Compact Disc Read-Only Memory), DVD-ROM (Digital Video Disc), or other optical media, may be provided. In these cases, each drive may be connected to bus 73 via one or more data media interfaces. Memory 72 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.

[0100] A program / utility 724 having a set (at least one) of program modules 725 may be stored, for example, in memory 72. Such program modules 725 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 725 typically perform the functions and / or methods described in the embodiments of the present invention.

[0101] The computer system can also communicate with one or more external devices 74 (e.g., keyboard, pointing device, display 75, etc.), and with one or more devices that enable a user to interact with the computer system, and / or with any device that enables the computer system to communicate with one or more other computing devices (e.g., network interface card, modem, etc.). This communication can be performed via input / output (I / O) interface 76. Furthermore, the computer system can communicate with one or more networks via network adapter 77, such as LAN (Local Area Network), WAN (Wide Area Network), and / or public networks, such as the Internet. Network adapter 77 communicates with other modules of the computer system via bus 73. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with the computer system, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID (Redundant Arrays of Independent Disks) systems, tape drives, and data backup storage systems.

[0102] In summary, the page view layout method, storage medium, and electronic device described in this invention enable customization of the layout of non-self-developed pages. Modification of the page layout is achieved through methods such as hooking, inheritance, and overriding. The layout of pages provided by third-party SDKs or other non-self-developed pages can be customized according to the developer's business needs, allowing business development to break through the limitations of fixed page layouts. Flexible page layout enhances the diversity of developed businesses and further improves the user's interaction and operational experience. Setting up two or more custom pages enriches the page layout methods, making page layouts more diverse and further meeting more business development needs. This invention effectively overcomes the various shortcomings of existing technologies and has high industrial application value.

[0103] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A method for laying out a page view, characterized in that, The layout method for the page view includes: Define the target page; the target page refers to the page whose layout needs to be modified; the target page cannot be modified according to the page requirements; A desired page is defined, which inherits from the target page; the desired page and the target page share common attributes. The target page is overridden to obtain the view object; Add the view object to the desired page; Locate the component element in the target page and add it to the desired page; The layout of the desired page is determined based on the settings attributes of the view object and the component element; The process of overriding the target page to obtain the view object includes the following steps: The method for creating view elements in the target page is overridden; During the copying process, at least one of the following is modified: the size of the view elements in the target page and the content they display. Use the rewritten view element as the view object; The setting of the desired page includes the following steps: Determine the view creation requirements for the desired page; Based on the creation requirements, the view creation interface is called to create the view of the desired page.

2. The page view layout method according to claim 1, wherein the target page originates from a non-self-developed page whose layout has been modified according to business needs.

3. The page view layout method according to claim 1, wherein adding the view object to the desired page includes the following steps: The position where the view object is added on the desired page is taken as the first addition position; Call the first view addition function to add the view object to the area specified by the first addition position, according to the size and content of the overridden view object.

4. The page view layout method according to claim 1, wherein finding component elements in the target page and adding the component elements to the desired page includes the following steps: Retrieve the executable file of the target page; Search the executable file for the identification number corresponding to the component element; Delete the component element corresponding to the identification number from the target page, and add the component element corresponding to the identification number to the desired page.

5. The page view layout method according to claim 4, wherein adding the component element corresponding to the identification number to the desired page includes the following steps: The position where the component element is added on the desired page is taken as the second addition position; Call the second view add function to add the component element to the area specified by the second add position according to at least one of the component element's size and the content to be presented.

6. The page view layout method according to claim 1, after the step of determining the desired page layout based on the setting attributes of the view object and the component element, the page view layout method further includes the following steps: Set up two or more of the desired pages; By combining the layouts of all the desired pages, determine the overall layout of the page view.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the layout method of the page view according to any one of claims 1 to 6.

8. An electronic device, characterized in that, include: Processor and memory; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to cause the electronic device to perform the page view layout method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method for inheriting a wiki page layout for a wiki page

    CN101484894A

  • A business page customization method and system

    CN109597614A