CN117234499A - Bubble generation method and device, electronic equipment and storage medium - Google Patents

Bubble generation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117234499A
CN117234499A CN202311277279.3A CN202311277279A CN117234499A CN 117234499 A CN117234499 A CN 117234499A CN 202311277279 A CN202311277279 A CN 202311277279A CN 117234499 A CN117234499 A CN 117234499A
Authority
CN
China
Prior art keywords
bubble
control
parameters
preset
target control
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311277279.3A
Other languages
Chinese (zh)
Inventor
王维红
修怀忠
叶松林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing Seres New Energy Automobile Design Institute Co Ltd
Original Assignee
Chongqing Seres New Energy Automobile Design Institute Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing Seres New Energy Automobile Design Institute Co Ltd filed Critical Chongqing Seres New Energy Automobile Design Institute Co Ltd
Priority to CN202311277279.3A priority Critical patent/CN117234499A/en
Publication of CN117234499A publication Critical patent/CN117234499A/en
Pending legal-status Critical Current

Links

Landscapes

  • User Interface Of Digital Computer (AREA)

Abstract

The application relates to the technical field of computers, and provides a bubble generation method, a bubble generation device, electronic equipment and a storage medium. In the method, when a target control needs to display a bubble, the bubble control can be created and bound with the target control, so that the reusability of the bubble control is improved; and the bubble configuration parameters can be set according to the service requirements, so that the bubble configuration parameters corresponding to the bubble control can be flexibly configured. In this way, the bubble generation method provided by the embodiment can improve the reusability of the bubble control, and can realize flexible configuration of the bubble configuration parameters corresponding to the bubble control, thereby improving the bubble generation efficiency.

Description

Bubble generation method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for generating bubbles, an electronic device, and a storage medium.
Background
In the prior art, if bubbles need to be displayed in a page, when page code writing is performed, a control for displaying the bubbles needs to be placed in advance, some shape files (such as shapes, colors and the like of the bubbles) need to be written, then the control for displaying the bubbles is set to be invisible, and the control is set to be in a visible state when the control needs to be displayed. However, if the same bubble is required to be displayed on the same page or multiple pages, the code for laying out the bubble needs to be written in multiple page codes manually; if the color and shape of the bubble need to be changed, a plurality of shape files need to be written manually. Therefore, the universality of generating bubble controls in the page is not strong enough, and multiplexing cannot be achieved in the prior art.
Disclosure of Invention
In view of the above, embodiments of the present application provide a method, an apparatus, an electronic device, and a computer readable storage medium for generating bubbles, so as to solve the problem in the prior art that the universality of generating bubble controls in pages is not strong enough and multiplexing cannot be achieved.
In a first aspect of an embodiment of the present application, there is provided a bubble generation method, including:
responding to a bubble generation instruction, generating a bubble control, and determining a bubble configuration parameter and a target control corresponding to the bubble control;
configuring the bubble control by utilizing the bubble configuration parameters and the target control to obtain a configured bubble control;
and adding the configured bubble control to a parent container of the target control.
In a second aspect of the embodiment of the present application, there is provided a bubble generating apparatus, the apparatus comprising:
the first determining unit is used for responding to the bubble generation instruction, generating a bubble control and determining a bubble configuration parameter and a target control corresponding to the bubble control;
the second determining unit is used for configuring the bubble control by utilizing the bubble configuration parameters and the target control to obtain a configured bubble control;
And the control adding unit is used for adding the configured bubble control to the parent container of the target control.
In a third aspect of embodiments of the present application, there is provided an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the method mentioned in the first aspect above when the computer program is executed.
In a fourth aspect of embodiments of the present application, there is provided a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method mentioned in the first aspect.
Compared with the prior art, the embodiment of the application has the beneficial effects that: in this embodiment, a bubble control may be generated in response to a bubble generation instruction, and a bubble configuration parameter and a target control corresponding to the bubble control may be determined; then, the bubble control can be configured by utilizing the bubble configuration parameters and the target control, so as to obtain a configured bubble control; finally, the configured bubble control may be added to a parent container of the target control. In this embodiment, when there is a target control that needs to display a bubble, a bubble control may be created and the bubble control may be bound to the target control, so as to improve the reusability of the bubble control; and the bubble configuration parameters can be set according to the service requirements, so that the bubble configuration parameters corresponding to the bubble control can be flexibly configured. In this way, the bubble generation method provided by the embodiment can improve the reusability of the bubble control, and can realize flexible configuration of the bubble configuration parameters corresponding to the bubble control, thereby improving the bubble generation efficiency.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic view of an application scenario according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of a bubble generation method according to an embodiment of the present application;
FIG. 3a is a schematic flow chart of a bubble generation method according to an embodiment of the present application;
FIG. 3b is a schematic flow chart of a method for generating bubbles according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of a bubble generating device according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
A bubble generating method and apparatus according to an embodiment of the present application will be described in detail with reference to the accompanying drawings.
Fig. 1 is a schematic view of an application scenario according to an embodiment of the present application. The application scenario may include terminal devices 1, 2 and 3, a server 4 and a network 5.
The terminal devices 1, 2 and 3 may be hardware or software. When the terminal devices 1, 2 and 3 are hardware, they may be various electronic devices having a display screen and supporting communication with the server 4, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like; when the terminal apparatuses 1, 2, and 3 are software, they may be installed in the electronic apparatus as described above. The terminal devices 1, 2 and 3 may be implemented as a plurality of software or software modules, or as a single software or software module, to which the embodiments of the present application are not limited. Further, various applications, such as a data processing application, an instant messaging tool, social platform software, a search class application, a shopping class application, and the like, may be installed on the terminal devices 1, 2, and 3.
The server 4 may be a server that provides various services, for example, a background server that receives a request transmitted from a terminal device with which communication connection is established, and the background server may perform processing such as receiving and analyzing the request transmitted from the terminal device and generate a processing result. The server 4 may be a server, a server cluster formed by a plurality of servers, or a cloud computing service center, which is not limited in this embodiment of the present application.
The server 4 may be hardware or software. When the server 4 is hardware, it may be various electronic devices that provide various services to the terminal devices 1, 2, and 3. When the server 4 is software, it may be a plurality of software or software modules providing various services to the terminal devices 1, 2 and 3, or may be a single software or software module providing various services to the terminal devices 1, 2 and 3, to which the embodiment of the present application is not limited.
The network 5 may be a wired network using coaxial cable, twisted pair wire, and optical fiber connection, or may be a wireless network that can implement interconnection of various communication devices without wiring, for example, bluetooth (Bluetooth), near field communication (Near Field Communication, NFC), infrared (Infrared), etc., which is not limited in the embodiment of the present application.
The vehicle may establish a communication connection with the server 4 via the network 5 by the terminal devices 1, 2, and 3 to receive or transmit information or the like. Specifically, the terminal device may first generate a bubble control in response to a bubble generation instruction, and determine a bubble configuration parameter and a target control corresponding to the bubble control. And then, the terminal equipment can configure the bubble control by utilizing the bubble configuration parameters and the target control to obtain the configured bubble control. The terminal device may then add the configured bubble control to the parent container of the target control. In this embodiment, when there is a target control that needs to display a bubble, a bubble control may be created and the bubble control may be bound to the target control, so as to improve the reusability of the bubble control; and the bubble configuration parameters can be set according to the service requirements, so that the bubble configuration parameters corresponding to the bubble control can be flexibly configured. In this way, the bubble generation method provided by the embodiment can improve the reusability of the bubble control, and can realize flexible configuration of the bubble configuration parameters corresponding to the bubble control, thereby improving the bubble generation efficiency.
It should be noted that the specific types, numbers and combinations of the terminal devices 1, 2 and 3, the server 4 and the network 5 may be adjusted according to the actual requirements of the application scenario, which is not limited in the embodiment of the present application.
Fig. 2 is a schematic flow chart of a bubble generation method according to an embodiment of the present application. The bubble generation method of fig. 2 may be performed by the terminal device of fig. 1. As shown in fig. 2, the bubble generation method includes:
s201, responding to a bubble generation instruction, generating a bubble control, and determining a bubble configuration parameter and a target control corresponding to the bubble control.
In this embodiment, when it is detected that a user generates a bubble for a control in a page, a bubble generation instruction may be triggered. Wherein, the bubble generation instruction can be understood as an instruction for triggering generation of bubbles in a control of the page; in this embodiment, for convenience of description, a control that needs to generate bubbles may be referred to as a target control, for example, a search control needs to generate bubbles on the search control, and the search control may be referred to as the target control. Then, a bubble control can be generated in response to the bubble generation instruction, and a bubble configuration parameter and a target control corresponding to the bubble control are determined.
In an implementation manner of this embodiment, a manner of generating the bubble control may specifically be: firstly, generating a bubble setting function according to the bubble generation instruction; then, according to the bubble setting function, generating a bubble control, for example, a class can be created according to the bubble setting function and named as a bubble control, so that the bubble control is inherited to the text control of the Android system. The bubble setting function can comprise view parameters and text parameters, the parameter type corresponding to the view parameters is a view control, and the parameter type corresponding to the text parameters is a character string; it is understood that the view parameter is an appearance parameter of the air bubble, and may include, for example, a shape, a color, and the like of the air bubble; the text parameter is text information presented in the bubble, and for example, the text parameter may include a text color presented in the bubble, a text font size, a margin around the text, a background color of the text, and the like. It should be noted that the bubbles may be used anywhere, including in Activity, dialog, fragments, etc., and may be used directly, for example, a rounded, gray background bubble may be required to be packaged as a separate function.
In this embodiment, the bubble generating instruction may include a preset label corresponding to a preset view parameter, or a bubble appearance parameter set by a user. It should be noted that, a preset label corresponding to a preset view parameter may be used to query a bubble text parameter corresponding to the preset label, where a correspondence between the preset label and the bubble text parameter corresponding to the preset label is preset; the bubble appearance parameters set by the user can be understood as the bubble appearance parameters set by the user when the bubble setting function is created. In this way, the preset label corresponding to the preset view parameter in the bubble generation instruction, or the bubble appearance parameter set by the user, may be used as the view parameter in the bubble setting function, that is, the view parameter in the bubble setting function includes the preset label corresponding to the preset view parameter, or the bubble appearance parameter set by the user.
The bubble generation instruction may further include preset text information or bubble text information set by a user. The preset text information may be understood as preset text information, and the bubble text information set by the user may be understood as bubble text information set by the user when creating the bubble setting function. In this way, the bubble text information preset in the bubble generation instruction or the bubble text information set by the user can be used as the text parameter in the bubble setting function, that is, the text parameter in the bubble setting function includes the preset text information or the bubble text information set by the user.
In an implementation manner of this embodiment, the method for determining the bubble configuration parameter and the target control corresponding to the bubble control may include the following steps:
and firstly, taking a target control set by a user in the bubble generation instruction as a target control corresponding to the bubble control. It will be appreciated that the bubble generation instructions may include a target control therein, which may be a user-set target control.
And then, determining the bubble configuration parameters corresponding to the bubble control according to the view parameters and the text parameters in the bubble setting function. Wherein the bubble configuration parameters include: the bubble appearance parameters and bubble text parameters, for example, may include the shape, color, etc. of the bubble, and the bubble text parameters may include the text color, text font size, margin around the text, background color of the text, etc. presented in the bubble.
Specifically, in this embodiment, the tag acquiring method (for example, public Object getTag ()) of the view parameter may be called first, and the tag corresponding to the view parameter may be obtained.
If the label corresponding to the view parameter is empty, it is indicated that the preset bubble does not exist in the view parameter, a bubble appearance parameter set by a user (i.e., bubble text information set by the user in the view parameter) can be obtained, a target label corresponding to the bubble appearance parameter set by the user is generated, the target label is used as the label corresponding to the view parameter, and the bubble appearance parameter corresponding to the target label is used as the bubble appearance parameter in the bubble configuration parameter corresponding to the bubble control. As an example, as shown in fig. 3b, if the tag corresponding to the view parameter is air-conditioner, a binding objective function of the bubble object is called, and a bubble object is directly created, wherein if the bubble appearance parameter of the bubble object is not set, the default bubble appearance parameter is used, and the bubble appearance parameter set by the user can also be obtained; and then, calling a label setting method of the view parameters to set the bubble as a label of the view (namely, a target label corresponding to the bubble appearance parameters set by the user), so that repeated creation of bubble objects can be prevented, and the memory overhead is saved.
If the label corresponding to the view parameter is a preset label, it is indicated that a preset bubble exists in the view parameter, and at this time, the label type needs to be converted into a bubble control type, that is, a bubble appearance parameter corresponding to the preset label can be obtained from a preset configuration file, a database or a server according to the preset label, and the bubble appearance parameter corresponding to the preset label is used as a bubble appearance parameter in the bubble configuration parameters corresponding to the bubble control. The configuration file and the database can be arranged locally on the terminal. It can be understood that the bubble appearance parameters corresponding to the preset tag may be preset in a configuration file, a database or a server, so that the bubble appearance parameters corresponding to the preset tag can be obtained from the configuration file or the database local to the terminal, or the bubble appearance parameters corresponding to the preset tag can be obtained from the server in the form of interface call.
At least one configuration file can be set locally by the terminal, and each configuration file can correspond to different bubbles. The configuration file is generated as follows: creating a file object (wherein the file object is a file reference for operating a file at a client, the content stored in the file object is a bubble appearance parameter corresponding to a preset label), designating a directory and a file name to the file object, judging whether the file name under the directory exists or not, directly creating if the file name does not exist, converting data in a configuration file into json format, and reading and writing the configuration file. The database may be generated as follows: 1. the newly built database is named as 'kj_services.db'; 2. newly establishing a database table name as a bubble appearance table in the database; 3. the table fields of the bubble appearance table are: id. Shape, color, availability, convert to sql statement: create table if not exists Kj_bubble_application' integer primary key autoincrement, an enabled port null, a port shape port text, a port color port text; A database service management class is created for operating a database table, wherein the database service management class is called a bubble appearance operation class (namely, some methods for operating the database, such as inquiring data from the database and adding the data into the database), 5, a query function is newly built in the bubble appearance table, namely, the contents of all rows are inquired from the bubble appearance table, 6, an insertion function is newly built in the bubble appearance table, namely, the bubble appearance parameters are newly added into the table for storage, namely, the bubble appearance parameters corresponding to preset labels are stored in the server, and the bubble appearance parameters are returned from the server to a client through an interface mode when the bubble appearance parameters corresponding to the preset labels are needed each time.
It should be noted that, the setting mode of the bubble appearance parameter corresponding to the preset label may be:
creating a local configuration class, wherein the member variables comprise: (1) Creating an enumeration class name, called color enumeration, in which constants are defined: red, gray and dark gray, which is equivalent to configuring a color configuration table for the bubble control; creating a member variable in the bubble class, named bubble color, variable type: color enumeration, action: for indicating the color that the bubble exhibits on the interface, and a default value, for example red, may be preset. (2) Creating an enumeration class called shape enumeration, in which constants are defined, called shape enumeration: round, rectangular, small dots, corresponding to configuring a local shape configuration table for the bubble control; creating a member variable in the bubble class, named bubble shape, variable type: shape enumeration, action: for representing the shape of the bubble exhibited on the interface, and a default value, such as a circle, may be preset.
In order to obtain the bubble appearance parameters corresponding to the preset tag from the configuration file or the database local to the terminal, or obtain the bubble appearance parameters corresponding to the preset tag from the server in the form of interface call, in this embodiment, a method capable of reading and writing data from the configuration file, the database or the server is also required to be created, which specifically includes: 1. creating a file reading method, specifically creating a file input stream object, and calling a file input stream reading method to read content from a file; if the read result is a byte array, the byte array can be converted into a character string, the character string is a json character string, and then the json character string is converted into a corresponding enumeration type. 2. Creating a file writing method, specifically creating a file output stream object, designating a file name for the output stream, wherein the file output stream object is used for converting the content to be written into json character strings, and then calling an acquisition byte array method of the character strings to convert the character strings into byte arrays; calling the writing method of the file output stream object can enter the byte array into the file, and finally closing the file output stream. 3. A method of reading to create a database, for example, a table in the sql statement query database may be written: select kj_bubble_application, all shapes and colors are queried from the table, and converted into corresponding enumeration types, respectively. 4. A method of writing to create a database, in particular, in which method, a table is written in which sql statements are inserted into the database: insert into kj_bubble_application values (.
Accordingly, in this embodiment, the method for obtaining the bubble appearance parameter corresponding to the preset tag may be: firstly, a file reading method is called to obtain bubble appearance parameters corresponding to preset labels from a local configuration file; if the acquired data are empty, then a database reading method is called to acquire a bubble appearance parameter configuration file corresponding to the preset label from the database; if the acquired data is air conditioner, a server interface is called, and the bubble appearance parameters corresponding to the preset labels are acquired from the server; after the bubble appearance parameters corresponding to the preset labels are obtained, a method for writing in files is called, data is stored in a local configuration file, a method for writing in a database is called, and meanwhile the bubble appearance parameters corresponding to the preset labels are stored in the database. In this embodiment, the design provides the diversity of the source of the data of the shielding bottom layer and flexibility, and can add and delete the source modes of the bubble appearance parameters corresponding to the preset labels.
In one implementation, the bubble configuration parameter stored in the preset configuration file, database or server is a byte array. Correspondingly, the mode of taking the bubble appearance parameter corresponding to the preset label as the bubble appearance parameter in the bubble configuration parameters corresponding to the bubble control may specifically be: firstly, converting bubble appearance parameters corresponding to the preset label from a byte array format to a json character string format; then, the bubble appearance parameters corresponding to the preset label can be converted from json character string format to enumeration type, and the bubble appearance parameters in the bubble configuration parameters corresponding to the bubble control are obtained.
If the text parameters comprise bubble text information set by a user, the bubble text information set by the user is used as bubble text parameters in bubble configuration parameters corresponding to the bubble control;
and if the text parameters comprise preset text information, taking the preset text information as bubble text parameters in bubble configuration parameters corresponding to the bubble control.
S202, configuring the bubble control by utilizing the bubble configuration parameters and the target control to obtain the configured bubble control.
After determining the bubble configuration parameters corresponding to the bubble control, the bubble control can be configured by utilizing the bubble configuration parameters and the target control, and the configured bubble control is obtained. As an example, as shown in fig. 3a, a global property is first created in the bubble control: target control, type: the view type of the Android system can determine which target control the bubble control acts on by using the global attribute and the type; then, an initialization method is newly established, the initialization method is called in a construction function of the bubble control, and the initialization method is written in: invoking a system method to set default text color, text font size, margin around the text, background color of the text and the like for the bubble control; then, a method for setting a text is newly established, and the method can set the set bubble text information to a bubble control for displaying the bubble text information on an interface; next, a function for setting the margin of the bubble can be newly built, specifically, a function is newly built in the bubble control, the function is used for setting the margin of the bubble, and writing is performed in the function: 1. acquiring layout parameters of bubble controls; 2. since the layout parameters are all inherited from the edge layout parameters (MarginLayoutParams) provided by the Android system, the left, right, upper and lower margins can be respectively set for the layout parameters of the bubble control; then, newly creating a binding objective function, wherein the parameters are of a system view type, and assigning the parameters to the objective controls in the global attribute; the creation method calls to set the appearance of the bubble, a function for setting the shape and the color is newly built in the bubble control, the function is used for setting the appearance of the bubble, and two parameters are needed in the function: parameter 1: the shape of the bubble, the parameter types are: shape enumeration; parameter 2: color of bubble, type of parameter: color enumeration; i.e. assigning parameter 1 and parameter 2 to the created function of the set shape color, respectively. In this embodiment, two settings are provided to set the shape and color of the air bubble:
Mode one: firstly, presetting and creating some xml resource files under a resource directory; setting a shape at a root node of an xml resource file, and setting a fillet attribute, a size attribute, a filling color, a tracing edge and the like under the shape node; if the shape of the bubble is circular, the width and the height of the bubble are equal; if the round angle is round angle, setting the round angle according to the size of the round angle; in the case of a rectangle, no rounded corners are provided or the rounded corners are set to 0. When the system is used, a background resource file is set for the bubble control, the resource file is set in the bubble control, and the system can be automatically loaded into a drawing object and displayed on an interface.
Mode two: the shape is set using the material design style. Creating a shape drawing object, namely instantiating the shape drawing object, providing configurable parameters for the shape drawing object through bubble appearance parameters in bubble configuration parameters, setting fillets, setting filling colors, setting drawing edges and the like, setting fillets, circles, rectangles and the like according to the shapes, and finally setting the shape drawing object to background parameters of a bubble control.
In this way, the bubble control is configured by using the bubble configuration parameters and the target control, and the configured bubble control is obtained.
And S203, adding the configured bubble control to a parent container of the target control.
After the configured bubble control is obtained, the configured bubble control can be added to a parent container of the target control, so that bubbles corresponding to the bubble control can be displayed in the target control of the interface.
Specifically, it may be first determined whether the bubble control has a parent container (i.e., the parent of the bubble control).
If the parent container of the configured bubble control is empty, the configured bubble control can be added to the parent container of the target control.
If the father container of the configured bubble control is a preset father container, namely the father container of the configured bubble control is not empty, the bubble control is indicated to be in the father container, at the moment, a bubble removal control method of the father container needs to be called to remove bubbles, namely a removal control of the preset father container is called to remove the configured bubble control from the preset father container; and adding the configured bubble control to a parent container of the target control.
In this embodiment, the manner of adding the configured bubble control to the parent container of the target control includes the following two manners:
First kind: if the type of the parent container of the target control is frame layout, adding the configured bubble control into the parent container of the target control;
second kind: and if the type of the parent container of the target control is a container, firstly acquiring layout parameters of the target control and a position index of the target control, wherein the position index of the target control is used for reflecting the position information of the target control in the parent container of the target control. Then, a frame of layout can be created as a bubble layout, layout parameters of the target control are assigned to the bubble layout, and the target control and the configured bubble control are added to the bubble layout. The bubble layout may then be added to the parent container of the target control according to the location index of the target control, i.e., the bubble layout is added to a location in the parent container of the target control corresponding to the location index of the target control.
As an example, as shown in fig. 3a, first, the target control call method public final ViewParent getParent () obtains the parent container of the target control, and the method is provided by the Android system. Then, the parent container type of the parent container of the target control is determined. If the parent container type of the parent container of the target control is a frame layout, then the bubble control is directly added to the parent container of the target control. If the parent container type of the parent container of the target control is a container, a specific position of the target control in the parent container is obtained first, a system method int index ofchild (View child) is called to obtain a position index, and the return value is a numerical value, which is called as a position index herein, and represents the position of the target control in the parent container.
Next, the layout parameters of the target control are obtained, and the parent container removes the target control from the container. Next, a frame layout is created and an id is set for it, called a bubble layout; assigning the layout parameter setting of the target control to the newly created bubble layout. Next, the target control is added to the bubble layout, and the bubble control is added to the bubble layout such that the level on the interface displayed by the bubble control is above the target control in the bubble layout. Finally, the bubble layout may be added to the parent container of the target control, specifically, the system method may be invoked: add View (View child, int index, layoutParams params), add the bubble layout to the parent container of the target control at the place of "location index", and set the layout parameters of the target control to the bubble layout, i.e. keep the layout parameters of the bubble control before binding to the target control and the parameters of the bubble layout after binding consistent.
Compared with the prior art, the embodiment of the application has the beneficial effects that: in this embodiment, a bubble control may be generated in response to a bubble generation instruction, and a bubble configuration parameter and a target control corresponding to the bubble control may be determined; then, the bubble control can be configured by utilizing the bubble configuration parameters and the target control, so as to obtain a configured bubble control; finally, the configured bubble control may be added to a parent container of the target control. In this embodiment, when there is a target control that needs to display a bubble, a bubble control may be created and the bubble control may be bound to the target control, so as to improve the reusability of the bubble control; and the bubble configuration parameters can be set according to the service requirements, so that the bubble configuration parameters corresponding to the bubble control can be flexibly configured. In this way, the bubble generation method provided by the embodiment can improve the reusability of the bubble control, and can realize flexible configuration of the bubble configuration parameters corresponding to the bubble control, thereby improving the bubble generation efficiency.
Any combination of the above optional solutions may be adopted to form an optional embodiment of the present application, which is not described herein.
The following are examples of the apparatus of the present application that may be used to perform the method embodiments of the present application. For details not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the method of the present application.
Fig. 4 is a schematic diagram of a bubble generating apparatus according to an embodiment of the present application. As shown in fig. 4, the bubble generating apparatus includes:
a first determining unit 401, configured to generate a bubble control in response to a bubble generation instruction, and determine a bubble configuration parameter and a target control corresponding to the bubble control;
a second determining unit 402, configured to configure the bubble control by using the bubble configuration parameter and the target control, to obtain a configured bubble control;
and the control adding unit 403 is configured to add the configured bubble control to a parent container of the target control.
Optionally, the first determining unit 401 is configured to:
generating a bubble setting function according to the bubble generation instruction; wherein the bubble setting function comprises view parameters and text parameters;
and generating a bubble control according to the bubble setting function.
Optionally, the first determining unit 401 is configured to:
taking a target control set by a user in the bubble generation instruction as a target control corresponding to the bubble control;
determining bubble configuration parameters corresponding to the bubble control according to view parameters and text parameters in the bubble setting function; wherein the bubble configuration parameters include: bubble appearance parameters and bubble text parameters.
Optionally, the view parameter in the bubble setting function includes a preset label corresponding to the preset view parameter, or a bubble appearance parameter set by a user; the text parameters in the bubble setting function comprise preset text information or bubble text information set by a user; the first determining unit 401 is configured to:
if the label corresponding to the view parameter is empty, acquiring the bubble appearance parameter set by the user, generating a target label corresponding to the bubble appearance parameter set by the user, taking the target label as the label corresponding to the view parameter, and taking the bubble appearance parameter corresponding to the target label as the bubble appearance parameter in the bubble configuration parameter corresponding to the bubble control;
If the label corresponding to the view parameter is a preset label, acquiring a bubble appearance parameter corresponding to the preset label from a preset configuration file, a database or a server according to the preset label, and taking the bubble appearance parameter corresponding to the preset label as a bubble appearance parameter in the bubble configuration parameters corresponding to the bubble control;
if the text parameters comprise bubble text information set by a user, the bubble text information set by the user is used as bubble text parameters in bubble configuration parameters corresponding to the bubble control;
and if the text parameters comprise preset text information, taking the preset text information as bubble text parameters in bubble configuration parameters corresponding to the bubble control.
Optionally, the air bubble configuration parameters stored in the preset configuration file, database or server are byte arrays;
the first determining unit 401 is configured to:
converting the bubble appearance parameters corresponding to the preset label from a byte array format to a json character string format;
and converting the bubble appearance parameters corresponding to the preset labels from json character string format to enumeration type to obtain the bubble appearance parameters in the bubble configuration parameters corresponding to the bubble control.
Optionally, the control adding unit 403 is configured to:
if the parent container of the configured bubble control is empty, adding the configured bubble control to the parent container of the target control;
if the father container of the configured bubble control is a preset father container, calling a removal control of the preset father container to remove the configured bubble control from the preset father container, and adding the configured bubble control to the father container of the target control.
Optionally, the control adding unit 403 is configured to:
if the type of the parent container of the target control is frame layout, adding the configured bubble control into the parent container of the target control;
if the type of the parent container of the target control is a container, acquiring layout parameters of the target control and a position index of the target control, wherein the position index of the target control is used for reflecting the position information of the target control in the parent container of the target control; creating a frame of layout as a bubble layout, assigning layout parameters of the target control to the bubble layout, and adding the target control and the configured bubble control to the bubble layout; and adding the bubble layout into a parent container of the target control according to the position index of the target control.
Compared with the prior art, the embodiment of the application has the beneficial effects that: in the bubble generation device provided in the embodiment, when a target control needs to display a bubble, the bubble control can be created and bound with the target control, so that the reusability of the bubble control is improved; and the bubble configuration parameters can be set according to the service requirements, so that the bubble configuration parameters corresponding to the bubble control can be flexibly configured. In this way, the bubble generation method provided by the embodiment can improve the reusability of the bubble control, and can realize flexible configuration of the bubble configuration parameters corresponding to the bubble control, thereby improving the bubble generation efficiency.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present application.
Fig. 5 is a schematic diagram of an electronic device 5 according to an embodiment of the present application. As shown in fig. 5, the electronic apparatus 5 of this embodiment includes: a processor 501, a memory 502 and a computer program 503 stored in the memory 502 and executable on the processor 501. The steps of the various method embodiments described above are implemented by processor 501 when executing computer program 503. Alternatively, the processor 501, when executing the computer program 503, performs the functions of the modules/units in the above-described apparatus embodiments.
The electronic device 5 may be a desktop computer, a notebook computer, a palm computer, a cloud server, or the like. The electronic device 5 may include, but is not limited to, a processor 501 and a memory 502. It will be appreciated by those skilled in the art that fig. 5 is merely an example of the electronic device 5 and is not limiting of the electronic device 5 and may include more or fewer components than shown, or different components.
The processor 501 may be a central processing unit (Central Processing Unit, CPU) or other general purpose processor, digital signal processor (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like.
The memory 502 may be an internal storage unit of the electronic device 5, for example, a hard disk or a memory of the electronic device 5. The memory 502 may also be an external storage device of the electronic device 5, for example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the electronic device 5. Memory 502 may also include both internal storage units and external storage devices of electronic device 5. The memory 502 is used to store computer programs and other programs and data required by the electronic device.
The application also provides a vehicle which can control the vehicle-mounted display to carry out icon placement processing by adopting the method.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, and the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of each of the method embodiments described above. The computer program may comprise computer program code, which may be in source code form, object code form, executable file or in some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth.
The above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (10)

1. A method of generating bubbles, the method comprising:
responding to a bubble generation instruction, generating a bubble control, and determining a bubble configuration parameter and a target control corresponding to the bubble control;
configuring the bubble control by utilizing the bubble configuration parameters and the target control to obtain a configured bubble control;
and adding the configured bubble control to a parent container of the target control.
2. The method of claim 1, wherein generating the bubble control comprises:
generating a bubble setting function according to the bubble generation instruction; wherein the bubble setting function comprises view parameters and text parameters;
And generating a bubble control according to the bubble setting function.
3. The method of claim 2, wherein determining the bubble configuration parameters and the target controls corresponding to the bubble controls comprises:
taking a target control set by a user in the bubble generation instruction as a target control corresponding to the bubble control;
determining bubble configuration parameters corresponding to the bubble control according to view parameters and text parameters in the bubble setting function; wherein the bubble configuration parameters include: bubble appearance parameters and bubble text parameters.
4. A method according to claim 3, wherein the view parameters in the bubble setting function include preset labels corresponding to the preset view parameters, or bubble appearance parameters set by a user; the text parameters in the bubble setting function comprise preset text information or bubble text information set by a user; the determining the bubble configuration parameters corresponding to the bubble control according to the view parameters and the text parameters in the bubble setting function comprises the following steps:
if the label corresponding to the view parameter is empty, acquiring the bubble appearance parameter set by the user, generating a target label corresponding to the bubble appearance parameter set by the user, taking the target label as the label corresponding to the view parameter, and taking the bubble appearance parameter corresponding to the target label as the bubble appearance parameter in the bubble configuration parameter corresponding to the bubble control;
If the label corresponding to the view parameter is a preset label, acquiring a bubble appearance parameter corresponding to the preset label from a preset configuration file, a database or a server according to the preset label, and taking the bubble appearance parameter corresponding to the preset label as a bubble appearance parameter in the bubble configuration parameters corresponding to the bubble control;
if the text parameters comprise bubble text information set by a user, the bubble text information set by the user is used as bubble text parameters in bubble configuration parameters corresponding to the bubble control;
and if the text parameters comprise preset text information, taking the preset text information as bubble text parameters in bubble configuration parameters corresponding to the bubble control.
5. The method of claim 4, wherein the bubble configuration parameters stored in the preset configuration file, database, or server are byte arrays;
the step of using the bubble appearance parameter corresponding to the preset label as the bubble appearance parameter in the bubble configuration parameter corresponding to the bubble control comprises the following steps:
converting the bubble appearance parameters corresponding to the preset label from a byte array format to a json character string format;
And converting the bubble appearance parameters corresponding to the preset labels from json character string format to enumeration type to obtain the bubble appearance parameters in the bubble configuration parameters corresponding to the bubble control.
6. The method of claim 1, wherein the adding the configured bubble control to the parent container of the target control comprises:
if the parent container of the configured bubble control is empty, adding the configured bubble control to the parent container of the target control;
if the father container of the configured bubble control is a preset father container, calling a removal control of the preset father container to remove the configured bubble control from the preset father container, and adding the configured bubble control to the father container of the target control.
7. The method of claim 6, wherein the adding the configured bubble control to the parent container of the target control comprises:
if the type of the parent container of the target control is frame layout, adding the configured bubble control into the parent container of the target control;
if the type of the parent container of the target control is a container, acquiring layout parameters of the target control and a position index of the target control, wherein the position index of the target control is used for reflecting the position information of the target control in the parent container of the target control; creating a frame of layout as a bubble layout, assigning layout parameters of the target control to the bubble layout, and adding the target control and the configured bubble control to the bubble layout; and adding the bubble layout into a parent container of the target control according to the position index of the target control.
8. A bubble generating apparatus, the apparatus comprising:
the first determining unit is used for responding to the bubble generation instruction, generating a bubble control and determining a bubble configuration parameter and a target control corresponding to the bubble control;
the second determining unit is used for configuring the bubble control by utilizing the bubble configuration parameters and the target control to obtain a configured bubble control;
and the control adding unit is used for adding the configured bubble control to the parent container of the target control.
9. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method according to any one of claims 1 to 7.
CN202311277279.3A 2023-09-28 2023-09-28 Bubble generation method and device, electronic equipment and storage medium Pending CN117234499A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311277279.3A CN117234499A (en) 2023-09-28 2023-09-28 Bubble generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311277279.3A CN117234499A (en) 2023-09-28 2023-09-28 Bubble generation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117234499A true CN117234499A (en) 2023-12-15

Family

ID=89094639

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311277279.3A Pending CN117234499A (en) 2023-09-28 2023-09-28 Bubble generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117234499A (en)

Similar Documents

Publication Publication Date Title
CN109725901A (en) Development approach, device, equipment and the computer storage medium of front-end code
CN109145238B (en) Card display method and device and mobile device
CN110941614A (en) Form generation method and device, electronic equipment and computer readable storage medium
CN106547580B (en) Method and device for hooking function, mobile terminal and storage medium
CN108279882B (en) Framework generation method, device, equipment and computer readable medium
CN111475162A (en) Page generation method, device, server and storage medium
CN110738038A (en) Contract text generation method, device, equipment and computer readable storage medium
CN113626223A (en) Interface calling method and device
CN113076153A (en) Interface calling method and device
CN113885935A (en) Resource packaging method and device, electronic equipment and computer readable storage medium
CN106022010A (en) File display method and device
CN115526160A (en) Rich text processing method, device and equipment and storage medium
CN113407254B (en) Form generation method and device, electronic equipment and storage medium
CN104375814A (en) Generation method and device of an interface document
CN110708423A (en) Message content display method and device and storage medium
CN108363574B (en) Front-end customization method and device based on SDK, terminal equipment and storage medium
CN117234499A (en) Bubble generation method and device, electronic equipment and storage medium
CN110673827A (en) Resource calling method and device based on android system and electronic equipment
CN109240660B (en) Access method of advertisement data, storage medium, electronic device and system
CN111831179B (en) Signing method, device and computer readable medium
CN114090083B (en) Visual component configuration method, device, equipment and storage medium
CN113656041A (en) Data processing method, device, equipment and storage medium
CN113312900A (en) Data verification method and device
CN115114280A (en) Report generation processing method, device and equipment
CN110795087B (en) Primitive processing method and device for UML design drawing and computer equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination