Element Display Methods and Devices
Patent Information
- Application Number
- CN202211109625.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-13
- Publication Date
- 2026-09-01
- Estimated Expiration
- 2042-09-13
AI Technical Summary
[0003]本申请实施例提供一种元素展示方法及装置,主要目的在于解决Activity框架中充斥大量的业务逻辑代码的问题,提高开发效率
Smart Images

Figure CN115373671B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of display technology, and in particular to a method and apparatus for displaying elements. Background Technology
[0002] With the development of technology, Android technology has also evolved. In the typical Android system development process, various business logics need to be set up in the business layer to meet different functionalities. However, as the business code is continuously iterated and updated, the code logic becomes increasingly complex and difficult to understand, a problem particularly acute in the element display process on the interface. Because the display methods of various elements in the Android system change depending on the element, such as changes in element color, text, width, height, and the display, hiding, and position of elements, each time an element changes or its display method changes, different code needs to be set up in the business layer to achieve different display effects. Therefore, when a large number of elements are added or the display effects change multiple times, the Activity framework will be scattered with such business logic code, severely reducing development efficiency. Summary of the Invention
[0003] This application provides an element display method and apparatus, the main purpose of which is to solve the problem of a large amount of business logic code in the Activity framework and improve development efficiency.
[0004] To address the aforementioned technical problems, this application provides the following technical solutions:
[0005] Firstly, this application provides a method for displaying elements, the method comprising:
[0006] The elements and their corresponding display parameters are determined in the element display set. The display parameters are the parameters that enable the display effect when the element is displayed. The element display set is determined by the Activity framework of the Android system.
[0007] Add the element and the corresponding display parameters to the behavior set;
[0008] When a display instruction is detected, the target element corresponding to the display instruction and the display parameters corresponding to the target element are determined based on the set of behaviors, and the target function is called to display the target element according to the display parameters.
[0009] Optionally, determining the elements and their corresponding display parameters in the element display set includes:
[0010] Get all elements from the element display set, and get a specified element from all elements, wherein the specified element is the element whose display effect has changed among all elements;
[0011] A preset component is used to add a marker to each of the specified elements and their corresponding display parameters.
[0012] Optionally, adding the element and the corresponding display parameters to the behavior set includes:
[0013] Add each specified element and its corresponding display parameters to the behavior set;
[0014] Add a mapping relationship between the elements in the element display set and the corresponding tags of the specified elements.
[0015] Optionally, when a display instruction is detected, determining the target element corresponding to the display instruction and the display parameters corresponding to the target element based on the set of behaviors, and calling the target function to display the target element according to the display parameters includes:
[0016] When the display instruction is detected, the element to be displayed is determined from the element display set based on the display instruction, and is used as the target element;
[0017] Based on the mapping relationship, the identifier corresponding to the target element is determined in the element display set, and the corresponding specified element is determined based on the identifier;
[0018] The target function is invoked to display the specified element according to the display parameters corresponding to the specified element.
[0019] Optionally, the marker includes annotation information, wherein the annotation information is used to indicate that the specified element needs to call a function when it is displayed according to the display parameters;
[0020] The process of calling the target function to display the specified element according to the display parameters corresponding to the specified element includes:
[0021] Obtain the tag, and determine the function corresponding to the specified element based on the annotation information in the tag, as the target function;
[0022] The target function is invoked to display the specified element according to the display parameters.
[0023] Optionally, the step of calling the target function to display the specified element according to the display parameters includes:
[0024] Based on the display instruction, determine whether the specified element to be displayed is the last element to be displayed in the display instruction;
[0025] If so, output a display completion message to inform the user that the display instruction has been completed;
[0026] If not, then based on the display instruction, the next element to be displayed from the element display set shall be determined as the target element.
[0027] Secondly, this application also provides an element display device, the method comprising:
[0028] The first determining unit is used to determine an element and the corresponding display parameters of the element in the element display set. The display parameters are the parameters that enable the display effect when the element is displayed. The element display set is determined by the Activity framework of the Android system.
[0029] An adding unit is used to add the element and the corresponding display parameters to the behavior set;
[0030] The second determining unit is used to determine the target element corresponding to the display instruction and the display parameters corresponding to the target element based on the behavior set when a display instruction is detected, and to call the target function to display the target element according to the display parameters.
[0031] Optionally, the first determining unit is specifically used to obtain all elements in the element display set, and to obtain a specified element from all elements, wherein the specified element is an element whose display effect has changed among all elements; and to add a mark to each specified element and its corresponding display parameters through a preset component.
[0032] Optionally, the adding unit is specifically used to add each of the specified elements and the corresponding display parameters to the behavior set; and to add a mapping relationship between the elements in the element display set and the tags of the corresponding specified elements.
[0033] Optionally, the second determining unit is specifically configured to, when the display instruction is detected, determine the element to be displayed from the element display set based on the display instruction, as the target element; and determine the identifier corresponding to the target element in the element display set according to the mapping relationship, and determine the corresponding specified element based on the identifier; and call the target function to display the specified element according to the display parameters corresponding to the specified element.
[0034] Optionally, the marker includes annotation information, wherein the annotation information is used to indicate that the specified element needs to call a function when it is displayed according to the display parameters;
[0035] The second determining unit is further configured to acquire the marker, and determine the function corresponding to the specified element based on the annotation information in the marker, as the target function; and call the target function to display the specified element according to the display parameters.
[0036] Optionally, the second determining unit is further configured to determine, based on the display instruction, whether the specified element to be displayed is the last element to be displayed in the display instruction; and if the specified element is the last element to be displayed in the display instruction, output a display completion prompt message to notify the user that the display instruction has been completed; and if the specified element is not the last element to be displayed in the display instruction, continue to determine the next element to be displayed from the element display set based on the display instruction, as the target element.
[0037] Thirdly, this application also provides a storage medium including a stored program, wherein the program controls the device where the storage medium is located to execute the element display method described in the first aspect when it is running.
[0038] Fourthly, this application also provides an element display device, the device including a storage medium; and one or more processors, the storage medium being coupled to the processors, the processors being configured to execute program instructions stored in the storage medium; the program instructions, when executed, perform the element display method described in any one of the first aspects.
[0039] By employing the above-described technical solution, the technical solution provided in this application has at least the following advantages:
[0040] This application provides an element display method and apparatus. Compared to existing technologies, this application, during the element display process, directly sets corresponding behavior sets for the elements in the element display set corresponding to the Activity framework. This avoids the need to add business logic code to the Activity framework when the element display method changes. In other words, this application replaces setting business logic code in the Activity framework. Therefore, during subsequent development iterations, developers will not be hindered by complex and difficult-to-understand business logic code in the Activity framework, thus improving development efficiency. Furthermore, the element display method of this application decouples the business logic code for element display from the Activity framework. This allows the element display effects to be adjusted directly in the behavior set, solving the problem of high development difficulty caused by severe coupling between business logic code and the Activity framework, thereby further improving development efficiency.
[0041] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0042] The above and other objects, features, and advantages of exemplary embodiments of this application will become readily understood by reading the following detailed description with reference to the accompanying drawings. In the drawings, several embodiments of this application are illustrated by way of example and not limitation, with the same or corresponding reference numerals denoteing the same or corresponding parts, wherein:
[0043] Figure 1 A flowchart of an element display method provided in an embodiment of this application is shown;
[0044] Figure 2 A flowchart illustrating another element display method provided in an embodiment of this application is shown;
[0045] Figure 3 This diagram illustrates a block diagram of an element display device provided in an embodiment of this application.
[0046] Figure 4 A block diagram of another element display device provided in an embodiment of this application is shown. Detailed Implementation
[0047] Exemplary embodiments of this application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art.
[0048] It should be noted that, unless otherwise stated, the technical or scientific terms used in this application shall have the ordinary meaning as understood by one of ordinary skill in the art to which this application pertains.
[0049] Currently, element display is generally based on the Activity framework. This means that business logic code for each element is added to the Activity framework, and when the Android system receives the instruction to display an element, it directly determines the display method and displays the element within the Activity framework. However, in practical applications, this conventional method, by directly adding the business logic code for each element's display to the Activity framework, results in the Activity framework becoming cluttered with this business logic code as the display process iterates, severely reducing development efficiency.
[0050] Based on this, embodiments of this application provide a flowchart of an element display method, such as... Figure 1 As shown, the method includes:
[0051] 101. Determine the elements and their corresponding display parameters in the element display set.
[0052] The display parameters are the parameters that enable the display effect of the element when it is displayed, and the element display set is determined by the Activity framework of the Android system.
[0053] In reality, different elements require different display effects during the element display process. For example, element A may need to be displayed in full screen, while element B may only need to be displayed in half screen. Or, element A may need to float in the interface for a period of time, while element B may only need to be displayed for a long time. Therefore, different elements, or even the same element at different times, require different display effects. These different display effects depend on the display parameter settings, which are preset by the user. These parameters include, but are not limited to, the element's color, text format, width and height, as well as the element's display duration, whether it is hidden, and its display position.
[0054] In a typical Android system, the display of elements relies on the Activity framework. This framework can be understood as a dedicated structure in Android for displaying elements on the interface and facilitating user interaction. At the business level, different display effects require different business logic code to ensure each element is displayed according to the user's needs. Consequently, as the number of elements to be displayed increases or their display effects change, different business logic code needs to be added to the Activity framework each time. This results in the Activity framework being cluttered with a large amount of business logic code during the continuous changes in display effects. This makes it difficult for subsequent developers to understand the previously added business logic code when adjusting the element display effects, slowing down the overall development progress.
[0055] In view of this, in this embodiment, the method of this step can be used to count the elements involved in the Activity framework, that is, to determine which elements are elements from the element display set determined by the Activity framework, and to determine the display parameters required for the display effect of these elements.
[0056] 102. Add the element and the corresponding display parameters to the behavior set.
[0057] Once the elements and their display parameters are determined, it becomes clear which data applies to the elements and their display effects during the interface display process. In this step, these elements and their display parameters need to be added to the behavior set. This behavior set can be understood as a separate set set for each element, independent of the Activity framework. It contains each element and its corresponding display parameters. This way, when the display effect of a certain element needs to be adjusted later, it is not necessary to adjust the element display set corresponding to the Activity framework. The adjustment can be made directly in the behavior set.
[0058] 103. When a display instruction is detected, the target element corresponding to the display instruction and the display parameters corresponding to the target element are determined based on the set of behaviors, and the target function is called to display the target element according to the display parameters.
[0059] In reality, the display of elements is not simply a matter of directly defining the element and its display parameters; it also requires the execution of a function. In other words, the element and display parameters only indicate how the element should be displayed, while the actual execution of the display effect requires the function to perform the task. Therefore, in this embodiment, upon detecting a display instruction, the system can determine which elements (i.e., target elements) are required by the instruction from among multiple elements in the behavior set. Then, based on the correspondence between the elements in the behavior set and the display parameters, the display parameters of the target element are directly determined. Finally, the corresponding target function is called to execute the function, thus achieving the effect of displaying the target element according to the display parameters.
[0060] It should be noted that the element display method in this embodiment only involves improvements at the business layer, not improvements at the code and function call layer. In other words, the way the target function is called and selected is consistent with the conventional calling method. This embodiment does not involve how to adjust the target function call.
[0061] In this embodiment, since a corresponding set of behaviors is additionally set for each element in the element display set corresponding to the Activity framework, when the element display method changes, the target element and its corresponding display parameters can be directly determined from the behavior set based on the display instructions, and the corresponding target function can be called for display. Therefore, compared to existing technologies, this avoids the need to add business logic code to the Activity framework to cope with changes in element display methods. In other words, the method of this application effectively replaces setting business logic code in the Activity framework. Subsequent developers will not experience development efficiency issues due to complex and difficult-to-understand business logic code in the Activity framework during subsequent development iterations, thereby improving development efficiency.
[0062] Furthermore, since the element display process is no longer executed in the way that business logic code is set in the conventional Activity framework, the element display method of this application decouples the business logic code for element display from the Activity framework. This is beneficial because whenever an element is displayed, whether the element to be displayed changes or the display parameters change, adjustments can be made directly in the behavior set. This solves the problem of the high development difficulty caused by the severe coupling between the business logic code for displaying elements and the Activity framework, thereby further improving development efficiency.
[0063] In this embodiment, another method for displaying elements is also provided as a further description and refinement of the foregoing embodiments. Specifically, it can be as follows: Figure 2As shown, it includes:
[0064] 201. Determine the elements and their corresponding display parameters in the element display set.
[0065] The display parameters are the parameters that enable the display effect of the element when it is displayed, and the element display set is determined by the Activity framework of the Android system.
[0066] Specifically, this step may include:
[0067] First, retrieve all elements from the element display set, and then retrieve a specified element from all elements, wherein the specified element is the element whose display effect has changed among all elements;
[0068] Secondly, a marker is added to each of the specified elements and the corresponding display parameters using a preset component.
[0069] Since the element display set corresponding to the Activity framework may include multiple different elements, and not all of these elements need to have their display effects changed or adjusted, the process of determining elements can begin by identifying all elements in the element display set. Then, based on this, we can determine which elements require or need to have their display effects changed—these are the designated elements. Finally, these designated elements are marked based on preset components. This achieves the effect of identifying only a portion of the specific elements that require display effect adjustment when the Activity framework contains a large number of elements that do not need to have their display effects adjusted, avoiding the process of marking all elements and reducing the overall execution efficiency of the element display method described in this embodiment.
[0070] Meanwhile, by adding tags to each specified element and its corresponding display parameters through preset components, the relationship between display parameters and specified elements can be determined in the form of tags, which is beneficial for determining elements directly based on the tags in the future, thus improving the determination efficiency.
[0071] It should be noted that the preset component mentioned in this embodiment can be a UIChange plugin. This plugin can be understood as a plugin specifically used to mark elements. Each marked element can be understood as having a dedicated field or identifier added. In this way, a binding relationship is added between each element with a corresponding relationship and the display parameters.
[0072] 202. Add the element and the corresponding display parameters to the behavior set.
[0073] Specifically, this step may include the following when executed:
[0074] Add each specified element and its corresponding display parameters to the behavior set;
[0075] Add a mapping relationship between the elements in the element display set and the corresponding tags of the specified elements.
[0076] Since Android systems typically require element determination within the Activity framework during the display process in practical applications, in order to avoid altering the system's built-in execution logic, this embodiment requires determining the correspondence between each element in the behavior set and the elements in the element display set during the process of adding the elements and their corresponding display parameters to the behavior set.
[0077] In one embodiment, after adding each specified element to the behavior set, a mapping relationship needs to be established between the specified elements in the behavior set and the copied elements in the original set. This involves establishing a mapping relationship between the behavior set and the element display set, ensuring that subsequent element display follows the element determination logic within the Android system. By determining elements from the element display set of the Activity framework and using this mapping relationship to determine the specified elements in the behavior set, the potential impact of modifying the element confirmation logic within the Android system on the system can be avoided.
[0078] 203. When a display instruction is detected, the target element corresponding to the display instruction and the display parameters corresponding to the target element are determined based on the set of behaviors, and the target function is called to display the target element according to the display parameters.
[0079] Specifically, this step may include the following when executed:
[0080] Step A: When the display instruction is detected, the element to be displayed is determined from the element display set based on the display instruction, and is taken as the target element.
[0081] Step B: Based on the mapping relationship, determine the identifier of the target element in the element display set, and determine the corresponding specified element based on the identifier.
[0082] Step C: Call the target function to display the specified element according to the display parameters corresponding to the specified element.
[0083] Upon receiving a display instruction, it indicates the existence of a task to display elements. To complete this task, it's necessary to determine which elements(s) correspond to the instruction, i.e., the target elements. This process utilizes Android's built-in logic to directly determine the elements within the display set. This eliminates the need for developers to compile the code described in this embodiment separately; instead, they can directly use Android's internal logic, thus improving compilation efficiency.
[0084] Since the preceding steps have established a mapping relationship between the elements in the element display set and the behavior set, once the target element is determined, the corresponding specified element in the behavior set can be determined based on this mapping relationship. Then, by calling the target function and displaying the specified element according to the display parameters, the display effect of the corresponding display instruction can be achieved.
[0085] Furthermore, the marker includes annotation information, wherein the annotation information is used to indicate that the specified element needs to call a function when it is displayed according to the display parameters;
[0086] The aforementioned step C can be specifically executed as follows:
[0087] Obtain the tag, and determine the function corresponding to the specified element based on the annotation information in the tag, as the target function;
[0088] The target function is invoked to display the specified element according to the display parameters.
[0089] Since there are many types of function functions, and the effects and functions of different function functions are completely different, in this embodiment, corresponding annotation information can be added to the label during the labeling of the specified element. Since the label of the specified element is corresponding, the required function function can be directly determined based on the annotation information during the display of the specified element. This saves the process of determining the target function from multiple function functions one by one, and can improve the overall execution efficiency of the element display method described in this embodiment.
[0090] Furthermore, since the element display process usually involves multiple different elements being displayed in different orders rather than a single element, the display instruction includes more than one element to be displayed. Therefore, in order to ensure that the display instruction can be fully executed, this embodiment also needs to determine whether it is the last element to be displayed while displaying the current target element, and perform further operations based on the determination result.
[0091] Based on this, the aforementioned step of calling the target function to display the specified element according to the display parameters can be specifically executed as follows:
[0092] Based on the display instruction, determine whether the specified element to be displayed is the last element to be displayed in the display instruction;
[0093] If so, output a display completion message to inform the user that the display instruction has been completed;
[0094] If not, then based on the display instruction, the next element to be displayed from the element display set shall be determined as the target element.
[0095] In this embodiment, the element to be displayed in the display instruction can be understood as an element that has not been displayed among multiple different elements, or an element that has not been displayed when there are multiple display effects of different order. The specific type and form of the element to be displayed are not limited here, and can be determined based on the actual content of the display instruction.
[0096] In this way, by determining whether the currently displayed element is the last element to be displayed based on the display instruction, it can be ensured that all elements are displayed when there are multiple elements in the display instruction, avoiding omissions. Furthermore, when it is determined that the currently displayed element is the last element to be displayed, a prompt message can be provided to the user, ensuring the prompt is effective upon completion of the instruction and preventing the user from mistakenly believing that the display is not yet complete and waiting.
[0097] Furthermore, as a response to the above Figure 1 , Figure 2 In addition to the implementation of the method shown, another embodiment of this application also provides an element display device. This device embodiment corresponds to the foregoing method embodiment. For ease of reading, this device embodiment will not repeat the details of the foregoing method embodiment, but it should be clear that the device in this embodiment can implement all the contents of the foregoing method embodiment. This device, in order to implement an element display method, can solve the problem of a large amount of business logic code in the Activity framework, improving development efficiency. Specifically, as shown... Figure 3 As shown, the device includes:
[0098] The first determining unit 31 can be used to determine an element and the corresponding display parameters of the element in the element display set. The display parameters are the parameters that enable the display effect when the element is displayed. The element display set is determined by the Activity framework of the Android system.
[0099] The adding unit 32 can be used to add the element and the corresponding display parameters to the behavior set;
[0100] The second determining unit 33 can be used to determine the target element corresponding to the display instruction and the display parameters corresponding to the target element based on the behavior set when a display instruction is detected, and call the target function to display the target element according to the display parameters.
[0101] Furthermore, such as Figure 4 As shown, the first determining unit 31 can be specifically used to obtain all elements in the element display set, and obtain a specified element from all elements, wherein the specified element is an element whose display effect has changed among all elements; and to add a mark to each specified element and its corresponding display parameters through a preset component.
[0102] Based on this, the first determining unit 31 may further include:
[0103] The acquisition module 311 can be used to acquire all elements in the element display set and acquire a specified element from all elements, wherein the specified element is an element whose display effect has changed among all elements;
[0104] Adding module 312 can be used to add markers to each of the specified elements and their corresponding display parameters through preset components.
[0105] Furthermore, such as Figure 4 As shown, the adding unit 32 is specifically used to add each specified element and its corresponding display parameters to the behavior set; and to add a mapping relationship between the elements in the element display set and the tags of the corresponding specified elements.
[0106] Based on this, the adding unit 32 may include:
[0107] The first adding module 321 can be used to add each specified element and its corresponding display parameters to the behavior set;
[0108] The second adding module 322 can be used to add a mapping relationship between the elements in the element display set and the corresponding tags of the specified elements.
[0109] Furthermore, such as Figure 4As shown, the second determining unit 33 is specifically used to, when the display instruction is detected, determine the element to be displayed from the element display set based on the display instruction as the target element; and determine the identifier corresponding to the target element in the element display set according to the mapping relationship, and determine the corresponding specified element based on the identifier; and call the target function to display the specified element according to the display parameters corresponding to the specified element.
[0110] Based on this, the second determining unit 33 includes:
[0111] The first determining module 331 can be used to determine, when the display instruction is detected, the element to be displayed from the element display set based on the display instruction, as the target element;
[0112] The second determining module 332 can be used to determine the identifier of the target element in the element display set according to the mapping relationship, and determine the corresponding specified element based on the identifier;
[0113] The execution module 333 can be used to call the target function to display the specified element according to the display parameters of the specified element.
[0114] Furthermore, such as Figure 4 As shown, the mark includes annotation information, wherein the annotation information can be used to characterize that the specified element needs to call a function when it is displayed according to the display parameters; the second determining unit 33 is further configured to obtain the mark, and determine the function corresponding to the specified element based on the annotation information in the mark, as the target function; and call the target function to display the specified element according to the display parameters.
[0115] Furthermore, the execution module 333 can be used to obtain the marker, and determine the function corresponding to the specified element based on the annotation information in the marker, as the target function; and call the target function to display the specified element according to the display parameters.
[0116] Furthermore, such as Figure 4 As shown, the second determining unit 33 is further configured to determine, based on the display instruction, whether the specified element to be displayed is the last element to be displayed in the display instruction; and if the specified element is the last element to be displayed in the display instruction, output a display completion prompt message to notify the user that the display instruction has been completed; and if the specified element is not the last element to be displayed in the display instruction, continue to determine the next element to be displayed from the element display set based on the display instruction, as the target element.
[0117] Specifically, the execution module 333 includes:
[0118] The judgment submodule 3331 can be used to determine, based on the display instruction, whether the specified element to be displayed is the last element to be displayed in the display instruction;
[0119] The prompt submodule 3332 can be used to output a display completion prompt message if the specified element is the last element to be displayed in the display instruction, so as to prompt the user that the display instruction has been completed;
[0120] The execution submodule 3333 can be used to determine the next element to be displayed from the element display set based on the display instruction if the specified element is not the last element to be displayed in the display instruction.
[0121] To achieve the above objectives, according to another aspect of this application, an embodiment of this application also provides a storage medium, the storage medium including a stored program, wherein, when the program is running, it controls the device where the storage medium is located to execute the element display method described above.
[0122] To achieve the above objectives, according to another aspect of this application, an embodiment of this application also provides an element display device, the device including a storage medium; and one or more processors, the storage medium being coupled to the processors, the processors being configured to execute program instructions stored in the storage medium; the program instructions, when executed, perform the element display method described above.
[0123] This application provides an element display method and apparatus. Compared to the prior art, this application, during the element display process, directly sets corresponding behavior sets for the elements in the element display set corresponding to the Activity framework. This avoids the need to add business logic code to the Activity framework when the element display method changes. In other words, it replaces setting business logic code in the Activity framework. Subsequent development iterations are not hampered by complex and difficult-to-understand business logic code in the Activity framework, thus improving development efficiency. Furthermore, the element display method of this application decouples the business logic code for element display from the Activity framework. The display effect of the elements can be directly adjusted in the behavior set, solving the problem of high development difficulty caused by severe coupling between business logic code and the Activity framework, thereby further improving development efficiency.
[0124] The element display device includes a processor and a memory. The first determining unit, the adding unit, the second determining unit, etc., are all stored in the memory as program units. The processor executes the program units stored in the memory to realize the corresponding functions.
[0125] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured; by adjusting kernel parameters, a method for displaying elements can be implemented. This can effectively address the problem of excessive business logic code in the Activity framework, improving development efficiency.
[0126] This application provides an element display device, the device including a storage medium and one or more processors, the storage medium being coupled to the processors, the processors being configured to execute program instructions stored in the storage medium; the program instructions, when executed, perform any of the aforementioned element display methods.
[0127] This application provides a storage medium that includes a stored program, wherein the program controls the device where the storage medium is located to execute the element display method described above when it is running.
[0128] Storage media may include non-permanent memory in the form of computer-readable media, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0129] This application provides a device including a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps: determining elements and corresponding display parameters in an element display set, wherein the display parameters are parameters that enable the display effect when the element is displayed, and the element display set is determined by the Activity framework of the Android system; adding the element and the corresponding display parameters to a behavior set; when a display instruction is detected, determining the target element corresponding to the display instruction and the display parameters corresponding to the target element based on the behavior set, and calling a target function to display the target element according to the display parameters.
[0130] Furthermore, determining the elements and their corresponding display parameters within the element display set includes:
[0131] Get all elements from the element display set, and get a specified element from all elements, wherein the specified element is the element whose display effect has changed among all elements;
[0132] A preset component is used to add a marker to each of the specified elements and their corresponding display parameters.
[0133] Furthermore, adding the element and the corresponding display parameters to the behavior set includes:
[0134] Add each specified element and its corresponding display parameters to the behavior set;
[0135] Add a mapping relationship between the elements in the element display set and the corresponding tags of the specified elements.
[0136] Furthermore, when a display instruction is detected, determining the target element corresponding to the display instruction and the display parameters corresponding to the target element based on the set of behaviors, and calling the target function to display the target element according to the display parameters includes:
[0137] When the display instruction is detected, the element to be displayed is determined from the element display set based on the display instruction, and is used as the target element;
[0138] Based on the mapping relationship, the identifier corresponding to the target element is determined in the element display set, and the corresponding specified element is determined based on the identifier;
[0139] The target function is invoked to display the specified element according to the display parameters corresponding to the specified element.
[0140] Furthermore, the marker includes annotation information, wherein the annotation information is used to indicate that the specified element needs to call a function when it is displayed according to the display parameters;
[0141] The process of calling the target function to display the specified element according to the display parameters corresponding to the specified element includes:
[0142] Obtain the tag, and determine the function corresponding to the specified element based on the annotation information in the tag, as the target function;
[0143] The target function is invoked to display the specified element according to the display parameters.
[0144] Furthermore, the step of calling the target function to display the specified element according to the display parameters includes:
[0145] Based on the display instruction, determine whether the specified element to be displayed is the last element to be displayed in the display instruction;
[0146] If so, output a display completion message to inform the user that the display instruction has been completed;
[0147] If not, then based on the display instruction, the next element to be displayed from the element display set shall be determined as the target element.
[0148] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing program code with the following initialization steps: determining elements and corresponding display parameters in an element display set, wherein the display parameters are parameters that enable the display effect when the element is displayed, and the element display set is determined by the Activity framework of the Android system; adding the element and the corresponding display parameters to a behavior set; when a display instruction is detected, determining the target element corresponding to the display instruction and the display parameters corresponding to the target element based on the behavior set, and calling a target function to display the target element according to the display parameters.
[0149] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0150] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0151] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0152] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0153] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0154] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0155] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, 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 technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0156] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0157] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0158] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for displaying elements, characterized in that, The method includes: Determining elements and their corresponding display parameters within an element display set includes: obtaining all elements from the element display set, and obtaining a specified element from all elements, wherein the specified element is an element whose display effect has changed among all elements; adding a marker to each specified element and its corresponding display parameter using a preset component to determine the relationship between the display parameter and the specified element in the form of a marker; wherein the display parameter is the parameter that enables the display effect when the element is displayed, and the element display set is determined by the Activity framework of the Android system; Adding the element and the corresponding display parameter to the behavior set includes: adding each specified element and the corresponding display parameter to the behavior set; adding a mapping relationship between the elements in the element display set and the tags of the corresponding specified elements; When a display instruction is detected, the target element corresponding to the display instruction and the display parameters corresponding to the target element are determined based on the behavior set, and the target element is displayed according to the display parameters by calling the target function. This includes: when the display instruction is detected, determining the element to be displayed from the element display set based on the display instruction as the target element; determining the identifier corresponding to the target element in the element display set according to the mapping relationship, and determining the corresponding specified element based on the identifier; and calling the target function to display the specified element according to the display parameters corresponding to the specified element.
2. The method according to claim 1, characterized in that, The marker includes annotation information, wherein the annotation information is used to indicate that the specified element needs to call a function when it is displayed according to the display parameters; The process of calling the target function to display the specified element according to the display parameters corresponding to the specified element includes: Obtain the tag, and determine the function corresponding to the specified element based on the annotation information in the tag, as the target function; The target function is invoked to display the specified element according to the display parameters.
3. The method according to claim 2, characterized in that, The step of calling the target function to display the specified element according to the display parameters includes: Based on the display instruction, determine whether the specified element to be displayed is the last element to be displayed in the display instruction; If so, output a display completion message to inform the user that the display instruction has been completed; If not, then based on the display instruction, the next element to be displayed from the element display set shall be determined as the target element.
4. An element display device, characterized in that, The device includes: The first determining unit is used to determine an element and the corresponding display parameters of the element in the element display set. The display parameters are the parameters that enable the display effect when the element is displayed. The element display set is determined by the Activity framework of the Android system. The first determining unit includes: an acquisition module, configured to acquire all elements in the element display set and acquire a specified element from all elements, wherein the specified element is an element whose display effect has changed among all elements; and an adding module, configured to add a mark to each specified element and its corresponding display parameter through a preset component, thereby determining the relationship between the display parameter and the specified element in the form of a mark. An adding unit is used to add the element and the corresponding display parameters to the behavior set; The adding unit includes: a first adding module, used to add each specified element and its corresponding display parameters to the behavior set; and a second adding module, used to add a mapping relationship between the elements in the element display set and the tags of the corresponding specified elements. The second determining unit is used to determine the target element corresponding to the display instruction and the display parameters corresponding to the target element based on the behavior set when a display instruction is detected, and to call the target function to display the target element according to the display parameters; The second determining unit includes: a first determining module, configured to, when the display instruction is detected, determine an element to be displayed from the element display set based on the display instruction, as the target element; a second determining module, configured to, according to the mapping relationship, determine an identifier corresponding to the target element in the element display set, and determine the corresponding specified element based on the identifier; and an execution module, configured to call a target function to display the specified element according to the display parameters corresponding to the specified element.
5. A storage medium, characterized in that, The storage medium includes a stored program, wherein the program, when running, controls the device where the storage medium is located to execute the element display method according to any one of claims 1-3.
6. An element display device, characterized in that, The device includes a storage medium; and one or more processors, the storage medium being coupled to the processors, the processors being configured to execute program instructions stored in the storage medium; the program instructions, when executed, perform the element display method according to any one of claims 1-3.