CN107122104B - Data display method and device - Google Patents

Data display method and device Download PDF

Info

Publication number
CN107122104B
CN107122104B CN201710199263.3A CN201710199263A CN107122104B CN 107122104 B CN107122104 B CN 107122104B CN 201710199263 A CN201710199263 A CN 201710199263A CN 107122104 B CN107122104 B CN 107122104B
Authority
CN
China
Prior art keywords
target data
display
row
data
displayed
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.)
Active
Application number
CN201710199263.3A
Other languages
Chinese (zh)
Other versions
CN107122104A (en
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.)
Jiangsu Jili Information Technology Co.,Ltd.
Original Assignee
Wuhan Douyu Network Technology 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201710199263.3A priority Critical patent/CN107122104B/en
Publication of CN107122104A publication Critical patent/CN107122104A/en
Application granted granted Critical
Publication of CN107122104B publication Critical patent/CN107122104B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04847Interaction techniques to control parameter settings, e.g. interaction with sliders or dials
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures

Abstract

The invention provides a data display method and device, and belongs to the technical field of graphical interface interaction. The method comprises the following steps: acquiring target data to be displayed; determining the display coordinates of each target data in the user-defined control according to the display size of each target data; and displaying each target data in the user-defined control according to the display coordinate of each target data. According to the display size of each target datum, the display coordinates of each target datum in the user-defined control are determined. And displaying each target data in the user-defined control according to the display coordinate of each target data. When the data are displayed, the target data of a plurality of different types can be displayed by setting one user-defined control without setting a plurality of controls, so that the setting process is simpler. In addition, when data is displayed subsequently, the data can be displayed through a user-defined control, so that more resources cannot be occupied due to excessive controls, and performance loss cannot be caused.

Description

Data display method and device
Technical Field
The invention relates to the technical field of graphical interface interaction, in particular to a data display method and device.
Background
Nowadays, mobile terminals such as smart phones and tablet computers are increasingly popularized, and more people browse data through the mobile terminals. The data type may be text, image, video, or the like. For example, for a web page displayed in a display screen of a mobile terminal, a user may browse more data by sliding the web page. Since the display process of data affects the experience and efficiency of browsing data, how to display data is a key issue.
The existing data display method mainly comprises the steps of setting a text display control and an image display control in a display view in advance, realizing text display through the text display control, and realizing image display through the image control. The text control can only display a text singly, and the image control can only display an image singly. For example, in an android system, by setting a text display control TextView and an image display control ImageView in a display view, the text and the image can be displayed respectively.
In the process of implementing the invention, the prior art is found to have at least the following problems: because the text display control and the image display control can only display single data, namely texts or images, when the number of texts and images is large, a plurality of controls need to be respectively arranged in the display view to display the texts and the images, and the setting process is complicated. In addition, in the subsequent display process, more resources are occupied due to more controls, and performance loss is caused.
Disclosure of Invention
In the prior art, a text display control and an image display control are set in a display view in advance, text display is realized through the text display control, and image display is realized through the image control. Because the text display control and the image display control can only display single data, namely texts or images, when the number of texts and images is large, a plurality of controls need to be respectively arranged in the display view to display the texts and the images, and the setting process is complicated. In addition, in the subsequent display process, more resources are occupied due to more controls, and performance loss is caused. To solve the above problems, the present invention provides a data display method and apparatus that overcomes or at least partially solves the above problems.
According to a first aspect of the present invention, there is provided a data display method, the method comprising:
step 1, acquiring target data to be displayed, wherein the type of the target data at least comprises a text and an image;
step 2, determining the display coordinates of each target data in the custom control according to the display size of each target data;
and 3, displaying each target data in the user-defined control according to the display coordinate of each target data.
According to the method provided by the invention, the display coordinates of each target data in the user-defined control are determined according to the display size of each target data by acquiring the target data to be displayed. And displaying each target data in the user-defined control according to the display coordinate of each target data. When the data are displayed, the target data of a plurality of different types can be displayed by setting one user-defined control without setting a plurality of controls, so that the setting process is simpler. In addition, when data is displayed subsequently, the data can be displayed through a user-defined control, so that more resources cannot be occupied due to excessive controls, and performance loss cannot be caused.
With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, the display size at least includes a display width and a display height, and the step 2 further includes:
step 21, determining the number of rows of each target data in the custom control according to the display width of each target data and the width of the custom control based on the display sequence of each target data;
and step 22, determining the display coordinate of each target data in the custom control according to the number of lines, the display width and the display height of each target data.
With reference to the second possible implementation manner of the first aspect, in a third possible implementation manner, the step 21 further includes:
step 211, accumulating the display width of each target data one by one according to the display sequence of each target data, and determining the kth row of target data in the custom control according to the accumulation result of the accumulation process, wherein K is a positive integer greater than 0;
and step 212, determining the next target data after the target data in the K-th line based on the display sequence of each target data, starting from the next target data, changing to the next line, and repeating the accumulation and determination process until the line number of each target data in the custom control is determined.
With reference to the third possible implementation manner of the first aspect, in a fourth possible implementation manner, the determining, in step 211, the kth line of target data in the custom control according to the accumulation result of the present accumulation process further includes:
when the accumulation result is larger than the width of the user-defined control, all target data except the last target data participating in the accumulation process are used as the K-th row of target data in the user-defined control;
and when the accumulation result is smaller than or equal to the width of the custom control, taking all target data participating in the accumulation process as the K-th line of target data in the custom control.
With reference to the second possible implementation manner or the third possible implementation manner of the first aspect, in a fifth possible implementation manner, the step 22 further includes:
step 221, for the target data in the K-th row in the custom control, determining a row height corresponding to the target data in the K-th row according to the display height of each target data in the K-th row;
step 222, determining the display coordinates of each target data in the line K +1 in the custom control according to the display order, the display width and the display height of the target data in the line K +1 and the line height corresponding to the target data in the line K based on the view coordinate system.
With reference to the fifth possible implementation manner of the first aspect, in a sixth possible implementation manner, the step 221 further includes:
and comparing the display height of each target data in the K-th row of target data, determining the maximum display height of the K-th row of target data, and taking the maximum display height as the row height corresponding to the K-th row of target data.
With reference to the second possible implementation manner or the third possible implementation manner of the first aspect, in a seventh possible implementation manner, the step 22 further includes:
and for the target data of the K-th row in the custom control, when K is equal to 1, determining the display coordinate of each target data of the 1 st row in the custom control according to the display sequence, the display width and the display height of the target data of the 1 st row based on the view coordinate system.
With reference to the first possible implementation manner of the first aspect, in an eighth possible implementation manner, the step 3 further includes:
and drawing each target data in the user-defined control according to the display coordinate of each target data based on the type of the target data.
With reference to the first possible implementation manner of the first aspect, in nine possible implementation manners, after the step 3, the method further includes:
and for the target data displayed in the custom control, when the touch operation on any target data is detected and any target data has a response function, responding to the touch operation based on any target data.
According to a second aspect of the present invention, there is provided a data display apparatus, the apparatus comprising at least one module for implementing the data display method provided by the first aspect or various possible implementations of the first aspect.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory and are not restrictive of the invention as claimed.
Drawings
FIG. 1 is a flow chart illustrating a data display method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a data display method according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a data display device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a data display device according to an embodiment of the present invention.
Detailed Description
The following detailed description of embodiments of the present invention is provided in connection with the accompanying drawings and examples. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
Nowadays, people browse data such as texts or images through mobile terminals, for example, browse text or image data in web pages. Since the display process of data affects the experience and efficiency of browsing data, how to display data is a key issue.
The existing data display method mainly comprises the steps of setting a text display control and an image display control in a display view in advance, realizing text display through the text display control, and realizing image display through the image control. The text control can only display a text singly, and the image control can only display an image singly. For example, in an android system, by setting a text display control TextView and an image display control ImageView in a display view, the text and the image can be displayed respectively.
To solve the problems in the prior art, an embodiment of the present invention provides a data display method. Referring to fig. 1, the method includes: 101. acquiring target data to be displayed; 102. determining the display coordinates of each target data in the user-defined control according to the display size of each target data; 103. and displaying each target data in the user-defined control according to the display coordinate of each target data.
The type of the target data may include text, image, video, and the like, which is not specifically limited in this embodiment. When the target data is displayed, the displayed shape may be a rectangle. For example, the image may be displayed in a rectangle, and the size of the rectangle corresponding to the image is the display size. The text can be displayed in a rectangular box, the size of the rectangular box is determined by the font size corresponding to the text, and the size of the rectangular box is the display size of the text. Since the corresponding display shape is a rectangle regardless of whether the target data is a text or an image, the display position of the target data can be determined by the upper left-hand corner coordinate and the lower right-hand corner coordinate. Accordingly, the display coordinates in step 102 may include the upper left corner coordinates and the lower right corner coordinates. Of course, the display coordinates may also be coordinates of four endpoints of a rectangle, and the like, and the content of the display coordinates is not particularly limited in this embodiment.
It should be noted that, before executing this embodiment and the subsequent embodiments, a custom control may be created in advance, and the shape of the custom control may also be a rectangle, which is not specifically limited in this embodiment. Accordingly, the execution processes of this embodiment and the following embodiments may correspond to the code execution logic corresponding to the custom control when displaying data. The present embodiment and the following embodiments mainly focus on describing how to display data through a control, and what code is used to implement the process, and neither the present embodiment nor the following embodiments is specifically limited. In addition, the size (i.e., the width and the height) of the custom control may be determined based on the target data to be displayed, or may be preset, which is not specifically limited in this embodiment and the subsequent embodiments.
According to the method provided by the embodiment of the invention, the display coordinates of each target data in the user-defined control are determined according to the display size of each target data by acquiring the target data to be displayed. And displaying each target data in the user-defined control according to the display coordinate of each target data. When the data are displayed, the target data of a plurality of different types can be displayed by setting one user-defined control without setting a plurality of controls, so that the setting process is simpler. In addition, when data is displayed subsequently, the data can be displayed through a user-defined control, so that more resources cannot be occupied due to excessive controls, and performance loss cannot be caused.
As an alternative embodiment, the display size at least includes a display width and a display height, and step 102 further includes:
determining the number of lines of each target data in the custom control according to the display width of each target data and the width of the custom control based on the display sequence of each target data;
and determining the display coordinate of each target data in the user-defined control according to the line number, the display width and the display height of each target data.
As an alternative embodiment, determining the number of rows of each target data in the custom control according to the display width of each target data and the width of the custom control based on the display order of each target data, further includes:
accumulating the display width of each target data one by one according to the display sequence of each target data, and determining the K-th row of target data in the user-defined control according to the accumulation result of the accumulation process, wherein K is a positive integer greater than 0;
and determining the next target data after the K-th row of target data based on the display order of each target data, changing to the next row from the next target data, and repeating the accumulation and determination processes until the row of each target data in the custom control is determined.
As an alternative embodiment, determining the kth line of target data in the custom control according to the accumulation result of the accumulation process, further includes:
when the accumulation result is larger than the width of the user-defined control, all target data except the last target data participating in the accumulation process are used as the K-th row of target data in the user-defined control;
and when the accumulation result is smaller than or equal to the width of the custom control, taking all target data participating in the accumulation process as the K-th line of target data in the custom control.
As an alternative embodiment, determining the display coordinates of each target data in the custom control according to the located line number, the display width and the display height of each target data includes:
for the K-th row of target data in the user-defined control, determining the line height corresponding to the K-th row of target data according to the display height of each target data in the K-th row of target data;
and determining the display coordinates of each target data in the K +1 th row in the custom control according to the display sequence, the display width and the display height of the target data in the K +1 th row and the row height corresponding to the target data in the K +1 th row based on the view coordinate system.
As an optional embodiment, for the kth line of target data in the custom control, determining, according to the display height of each target data in the kth line of target data, a line height corresponding to the kth line of target data, includes:
and comparing the display height of each target data in the K-th row of target data, determining the maximum display height of the K-th row of target data, and taking the maximum display height as the row height corresponding to the K-th row of target data.
As an alternative embodiment, determining the display coordinates of each target data in the custom control according to the located line number, the display width and the display height of each target data includes:
and for the target data of the K-th row in the custom control, when K is equal to 1, determining the display coordinate of each target data of the 1 st row in the custom control according to the display sequence, the display width and the display height of the target data of the 1 st row based on the view coordinate system.
As an alternative embodiment, step 103 further comprises:
and drawing each target data in the user-defined control according to the display coordinate of each target data based on the type of the target data.
As an alternative embodiment, the method further comprises:
and for the target data displayed in the custom control, when the touch operation on any target data is detected and any target data has a response function, responding to the touch operation based on any target data.
All the above-mentioned optional technical solutions can be combined arbitrarily to form the optional embodiments of the present invention, and are not described herein again.
Based on the content of the embodiment corresponding to fig. 1, an embodiment of the present invention provides a data display method. Referring to fig. 2, the method includes: 201. acquiring target data to be displayed; 202. determining the display coordinates of each target data in the user-defined control according to the display size of each target data; 203. displaying each target data in the user-defined control based on the display coordinates of each target data; 204. and for the target data displayed in the custom control, when the touch operation on any target data is detected and any target data has a response function, responding to the touch operation based on any target data.
Wherein 201, target data to be displayed is acquired.
As can be seen from the content of the embodiment corresponding to fig. 1, the type of the target data may at least include text, image and video, and the embodiment does not specifically limit the type of the target data. When the target data to be displayed is obtained, the target data may be obtained through a predefined method or interface, which is not specifically limited in this embodiment. For example, a text to be displayed can be acquired by a customized addText () method, and an image to be displayed can be acquired by a customized addImage ().
It should be noted that, in the subsequent steps, the display size of the target data to be displayed is also used, and it is also required to determine whether the target data to be displayed can respond to the touch operation, so that when the text is obtained by the addText () method, the text to be displayed can be taken as a parameter, and the display size and the response identifier can also be taken as parameters. Similarly, when the text is acquired by the addImage () method, the image to be displayed, the display size, and the response identifier may also be transmitted as parameters.
It should be noted that the above method may not transmit the display size when transmitting the parameters. When the display size is not transmitted, the display size may be displayed according to a default display size, which is not specifically limited in this embodiment.
The response identifier may represent whether the target data can respond to the touch operation. The value of the response identifier may be true or false, where true represents that the target data can respond to the touch operation, and false represents that the target data cannot respond to the touch operation. In addition, the touch operation may include operations such as single-click, double-click, folding, unfolding, or flicking, and the type of the touch operation is not specifically limited in this embodiment.
For facilitating further operations on the target data subsequently, the acquired target data to be displayed may be stored in a data set, for example, a datasist set, which is not specifically limited in this embodiment. In addition, the target data with response id true may be stored in a clickabelist set, which is not specifically limited in this embodiment.
And 202, determining the display coordinates of each target data in the custom control according to the display size of each target data.
The embodiment does not specifically limit the manner of determining the display coordinates of each target data in the custom control according to the display size of each target data, and includes but is not limited to: determining the number of lines of each target data in the custom control according to the display width of each target data and the width of the custom control based on the display sequence of each target data; and determining the display coordinate of each target data in the user-defined control according to the line number, the display width and the display height of each target data.
As can be seen from the contents of the embodiment corresponding to FIG. 1, the shapes of the target data and the custom control may be both rectangles. Based on the characteristic, when the target data is displayed in the custom control, the target data can be displayed in a divided manner. Therefore, in order to facilitate the subsequent determination of the display coordinates of the target data, the number of rows of the target data in the custom control can be determined first. The embodiment does not specifically limit the manner of determining the number of rows of each target data in the custom control according to the display width of each target data and the width of the custom control based on the display order of each target data, and includes but is not limited to: accumulating the display width of each target data one by one according to the display sequence of each target data, and determining the K-th row of target data in the user-defined control according to the accumulation result of the accumulation process, wherein K is a positive integer greater than 0; and determining the next target data after the K-th row of target data based on the display order of each target data, changing to the next row from the next target data, and repeating the accumulation and determination processes until the row of each target data in the custom control is determined.
In the above process, the display order of each target data may be determined by the order of storing the target data in the data set dataList, which is not specifically limited in this embodiment. In this embodiment, the method for determining the kth line of target data in the custom control according to the accumulation result of the accumulation process is not specifically limited, and includes but is not limited to: when the accumulation result is larger than the width of the user-defined control, all target data except the last target data participating in the accumulation process are used as the K-th row of target data in the user-defined control; and when the accumulation result is smaller than or equal to the width of the custom control, taking all target data participating in the accumulation process as the K-th line of target data in the custom control.
For example, taking the width of the custom control as 10, and taking the display width of each target data as 2, 3, 2, 4, 3, 2, 1, 3, 2 … … respectively according to the display order as an example. The display width of the target data is accumulated in the display order to obtain (2+3+2+4) ═ 11, i.e., greater than 10. Therefore, the target data which participate in the accumulation process and have display widths of 2, 3 and 2 can be used as the row 1 target data, that is, the first 3 target data can be used as the row 1 target data.
If the display width of each target data is 2, 3, 2, 1 according to the display order of each target data, there are only 4 target data. The display width of the target data is accumulated in the display order to obtain (2+3+2+1) ═ 8, i.e., less than 10. Therefore, the target data which participate in the present accumulation process and have display widths of 2, 3, 2, and 1, respectively, may be used as the line 1 target data, that is, the above-mentioned 4 target data may be used as the line 1 target data.
For step (2), after determining the kth line of target data in the custom control, each next line of target data may continue to be determined. For example, the display width of each object data is 2, 3, 2, 4, 3, 2, 1, 3, 2 … … in the display order. Through the above step (1), it can be determined that the target data with the display widths of 2, 3, and 2 are the 1 st line target data. Accordingly, the next target data of the 1 st line target data is 4 in the display order. Therefore, the next row, row 2, can be switched to and step (1) can be re-executed starting with row 4. Specifically, accumulating the display widths of the target data from 4 may result in (4+3+2+1+3) ═ 13, i.e., greater than 10. Therefore, the target data which participate in the accumulation process and respectively have display widths of 4, 3, 2 and 1 can be used as the 2 nd row target data. The process of accumulation and determination is repeated until the number of rows of each target data in the custom control is determined.
After determining the number of rows of the target data, the display coordinates of the target data in the custom control can be determined. Based on different line numbers, when the display coordinates of each target data in the custom control are determined according to the line number, the display width and the display height of each target data, the following two situations can be met.
In the first case: for the K-th row of target data in the user-defined control, determining the line height corresponding to the K-th row of target data according to the display height of each target data in the K-th row of target data; and determining the display coordinates of each target data in the K +1 th row in the custom control according to the display sequence, the display width and the display height of the target data in the K +1 th row and the row height corresponding to the target data in the K +1 th row based on the view coordinate system.
As can be seen from the above, when determining the number of rows of each target data in the custom control, the total number of rows determined last may be 1, or may be greater than 1. When the total number of rows is greater than 1, for the K-th row target data, the row height corresponding to the K-th row target data may be determined first. In this embodiment, the manner of determining the row height corresponding to the kth row of target data according to the display height of each target data in the kth row of target data is not specifically limited, and includes but is not limited to: and comparing the display height of each target data in the K-th row of target data, determining the maximum display height of the K-th row of target data, and taking the maximum display height as the row height corresponding to the K-th row of target data.
For convenience of explanation, K is 1. As can be seen from the above example, the object data having the display widths of 2, 3, and 2 are the object data of line 1, that is, line 1 includes 3 object data. Taking the display heights of the target data in the 1 st row as 2, 4 and 1 respectively as an example, after comparing the display heights of each target data in the 1 st row, the target data with the display width of 3 can be determined, and the value of the display height is the maximum, that is, 4 is the maximum display height. Therefore, 4 can be set as the row height corresponding to the row 1 target data. Similarly, the line heights of other rows may be determined in the manner described above.
After determining the line height corresponding to each line of target data, the display coordinates of each target data of the K +1 lines may be determined based on the line height of the K-th line. For convenience of explanation, the line height corresponding to the line 1 object data is 4, the display widths of the line 2 object data are 4, 3, 2, and 1, and the display heights are 2, 4, 3, and 1, respectively.
As can be seen from the content of the embodiment corresponding to fig. 1, the displayed shape of the target data may be a rectangle, so that when determining the display coordinates of the target data, only the upper left corner coordinates and the lower right corner coordinates of the target data need to be determined based on the view coordinate system. For the 1 st object data in the 2 nd line object data, the line height corresponding to the 1 st line object data is 4, so that the coordinates of the upper left corner of the 1 st object data are (0, 4). Since the display width of the 1 st object data is 4 and the display height is 2, the lower right-hand coordinate of the 1 st object data is (4, 6) with respect to the upper left-hand coordinate thereof.
For the 2 nd object data in the 2 nd line object data, since the line height corresponding to the 1 st line object data is 4, the coordinates of the bottom right corner of the 1 st object data are (4, 6), and the coordinates of the top left corner of the 2 nd object data are (4, 4). Since the display width of the 2 nd object data is 3 and the display height is 4, the lower right-hand coordinate of the 2 nd object data is (7, 8) with respect to the upper left-hand coordinate thereof. Similarly, the display coordinates of each target data in the custom control in the 2 nd row can be determined in the above manner.
Since the display shape of the target data is rectangular, the display coordinates of the target data can be expressed by the vertex coordinates in addition to the upper left-hand coordinates and the lower right-hand coordinates. In addition, the display coordinates may be represented by boundary coordinates, i.e., left, top, right, and bottom, and the representation form of the display coordinates is not particularly limited in this embodiment.
Where left represents the abscissa of the left boundary of the rectangular coordinate, right represents the abscissa of the right boundary of the rectangular coordinate, top represents the ordinate of the upper boundary of the rectangular coordinate, and bottom represents the ordinate of the lower boundary of the rectangular coordinate. For the 1 st object data in the 2 nd row of object data, left is 0 because its corresponding rectangular left boundary coincides with the y-axis of the view coordinate system. Since its display width is 4, right is 4. Since its corresponding upper rectangular boundary corresponds to the lower boundary of line 1, and the line height corresponding to the line 1 object data is 4, top is 4. Since the display height is 2, and the line height corresponding to the target data of the 1 st line is 4, the bottom is 6.
Similarly, it can be determined that the 2 nd object data left in the 2 nd line of object data is 4, right is 7, top is 4, and bottom is 8. In the above manner, the boundary coordinates of each target data in the K (K >1) th line can be determined.
For the case that the custom control has only 1 line of target data, i.e. determining the display coordinates of the 1 st line of target data, the following processing procedure of the second case may be referred to.
In the second case: and for the target data of the K-th row in the custom control, when K is equal to 1, determining the display coordinate of each target data of the 1 st row in the custom control according to the display sequence, the display width and the display height of the target data of the 1 st row based on the view coordinate system.
For example, the display widths of the 1 st line of target data are 2, 3, and 2, respectively, and the display heights are 2, 4, and 1, respectively. Based on the above principle, the coordinate of the top left corner of the 1 st target data in the 1 st row of target data is (0, 0), and the coordinate of the bottom right corner is (2, 2). When the representation form of the display coordinates is the boundary coordinates, the 1 st target data left is 0, right is 2, top is 0, and bottom is 2.
And determining the display coordinates of each target datum in the custom control based on the corresponding processing modes of the two conditions. In a specific implementation, the display coordinates of each target data may be determined by an onMeasure () method, which is not specifically limited in this embodiment. In addition, in order to facilitate the subsequent call of the target data and the corresponding display coordinates, after the display coordinates of each target data are determined, each target data and the corresponding display coordinates may be stored. For example, each target data and corresponding display coordinates may be stored in a javabean method. Where javabean has two member variables. One member variable is an Object type Object storing Object data, and the other member variable is a display coordinate mBounds storing the Object data, wherein each Object data corresponds to a javabean Object. Finally, the java bean object corresponding to each target data can be stored into the totalList data set according to the display order, so as to facilitate subsequent reading.
And 203, displaying each target data in the custom control based on the display coordinate of each target data.
After the display coordinates are determined, the target data may be displayed, via step 202 described above. The present embodiment does not specifically limit the way of displaying each target data in the custom control based on the display coordinates of each target data, and includes but is not limited to: and drawing each target data in the user-defined control according to the display coordinate of each target data based on the type of the target data.
For example, based on the content in step 202, each javabean object obj in the totalList set can be drawn according to its display coordinates mkouns by the onDraw () method of the custom control. Drawtext () is called to draw text if obj belongs to String, i.e., the target data is text. Draw Bitmap () is called to draw an image if obj belongs to Bitmap, i.e., the target data is an image.
And 204, for the target data displayed in the custom control, when the touch operation on any target data is detected and any target data has a response function, responding to the touch operation based on any target data.
As can be seen from the above step 201, there may be target data capable of responding to the touch operation in the target data displayed in the custom control. When the user triggers touch operation on the user-defined control, the touch coordinate of the user can be acquired. And determining which target data needs to be touched by the user according to the touch coordinates and the display coordinates of each target data, and determining whether the target data is in a clickblelist set. If the target data is in the clickabelist set, the target data is indicated to be capable of responding to the touch operation and responding to the touch operation. Otherwise, the touch operation is not responded.
The touch coordinates of the user may be obtained by an onTouchEvent () method, which is not specifically limited in this embodiment.
According to the method provided by the embodiment of the invention, the display coordinates of each target data in the user-defined control are determined according to the display size of each target data by acquiring the target data to be displayed. And displaying each target data in the user-defined control according to the display coordinate of each target data. When the data are displayed, the target data of a plurality of different types can be displayed by setting one user-defined control without setting a plurality of controls, so that the setting process is simpler. In addition, when data is displayed subsequently, the data can be displayed through a user-defined control, so that more resources cannot be occupied due to excessive controls, and performance loss cannot be caused.
In addition, the display coordinates of each target data in the user-defined control can be determined according to the display size of each target data, so that the display positions of the target data in the user-defined control can be reasonably arranged, and the experience and efficiency of subsequent users for browsing data are improved.
Based on the data display method provided by the embodiment corresponding to fig. 1 or fig. 2, an embodiment of the invention provides a data display device. Referring to fig. 3, the apparatus includes:
an obtaining module 301, configured to obtain target data to be displayed, where a type of the target data at least includes a text and an image;
a determining module 302, configured to determine, according to the display size of each target data, a display coordinate of each target data in the custom control;
and the display module 303 is configured to display each target data in the custom control according to the display coordinate of each target data.
As an alternative embodiment, the display size at least includes a display width and a display height, and the determining module 302 includes:
the first determining unit is used for determining the number of rows of each target data in the custom control according to the display width of each target data and the width of the custom control based on the display sequence of each target data;
and the second determining unit is used for determining the display coordinate of each target data in the custom control according to the line number, the display width and the display height of each target data.
As an alternative embodiment, the first determination unit includes:
the accumulation subunit is used for accumulating the display width of each target data one by one according to the display sequence of each target data, and determining the K-th row of target data in the user-defined control according to the accumulation result of the accumulation process, wherein K is a positive integer greater than 0;
and the first determining subunit is used for determining the next target data after the K-th row of target data based on the display order of each target data, changing to the next row from the next target data and repeating the accumulation and determination processes until the row number of each target data in the custom control is determined.
As an optional embodiment, the accumulation subunit is configured to, when the accumulation result is greater than the width of the custom control, use all target data participating in the present accumulation process except for the last target data as kth line target data in the custom control; and when the accumulation result is smaller than or equal to the width of the custom control, taking all target data participating in the accumulation process as the K-th line of target data in the custom control.
As an alternative embodiment, the second determination unit includes:
the second determining subunit is used for determining the line height corresponding to the target data in the K line according to the display height of each target data in the K line for the target data in the K line in the user-defined control;
and the third determining subunit is used for determining the display coordinates of each target data in the K +1 th row in the custom control according to the display order, the display width and the display height of the target data in the K +1 th row and the row height corresponding to the target data in the K +1 th row based on the view coordinate system.
As an alternative embodiment, the second determining subunit is configured to compare the display heights of each target data in the K-th row of target data, determine the maximum display height of the K-th row of target data, and use the maximum display height as the row height corresponding to the K-th row of target data.
As an optional embodiment, the second determining unit is configured to, for the kth line of target data in the custom control, determine, when K is equal to 1, display coordinates of each target data in the 1 st line in the custom control according to the display order, the display width, and the display height of the target data in the 1 st line based on the view coordinate system.
As an alternative embodiment, the display module 303 is configured to draw each target data in the custom control according to the display coordinate of each target data based on the type of the target data.
As an alternative embodiment, the apparatus further comprises:
and the response module is used for responding to the touch operation based on any target data when the touch operation on any target data is detected and the any target data has a response function for the target data displayed in the custom control.
According to the device provided by the embodiment of the invention, the display coordinates of each target data in the user-defined control are determined according to the display size of each target data by acquiring the target data to be displayed. And displaying each target data in the user-defined control according to the display coordinate of each target data. When the data are displayed, the target data of a plurality of different types can be displayed by setting one user-defined control without setting a plurality of controls, so that the setting process is simpler. In addition, when data is displayed subsequently, the data can be displayed through a user-defined control, so that more resources cannot be occupied due to excessive controls, and performance loss cannot be caused.
In addition, the display coordinates of each target data in the user-defined control can be determined according to the display size of each target data, so that the display positions of the target data in the user-defined control can be reasonably arranged, and the experience and efficiency of subsequent users for browsing data are improved.
The embodiment of the invention provides data display equipment. Referring to fig. 4, the data display apparatus includes: a processor (processor)401, a memory (memory)402, and a bus 403;
the processor 401 and the memory 402 respectively complete communication with each other through the bus 403;
the processor 401 is configured to call the program instructions in the memory 402 to execute the data display method provided in the corresponding embodiment of fig. 1 or fig. 2, for example, including: acquiring target data to be displayed, wherein the type of the target data at least comprises a text and an image; determining the display coordinates of each target data in the user-defined control according to the display size of each target data; and displaying each target data in the user-defined control according to the display coordinate of each target data.
The present invention discloses a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, which when executed by a computer, the computer is capable of performing the data display method provided by the corresponding embodiment of fig. 1 or fig. 2, for example, comprising: acquiring target data to be displayed, wherein the type of the target data at least comprises a text and an image; determining the display coordinates of each target data in the user-defined control according to the display size of each target data; and displaying each target data in the user-defined control according to the display coordinate of each target data.
The present invention provides a non-transitory computer-readable storage medium storing computer instructions, the computer instructions causing a computer to execute the data display method provided by the corresponding embodiment of fig. 1 or fig. 2, for example, the method includes: acquiring target data to be displayed, wherein the type of the target data at least comprises a text and an image; determining the display coordinates of each target data in the user-defined control according to the display size of each target data; and displaying each target data in the user-defined control according to the display coordinate of each target data.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
The above-described embodiments of the data display device and the like are merely illustrative, and units illustrated as separate components may or may not be physically separate, and components displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute the various embodiments or some parts of the methods of the embodiments.
Finally, the method of the present application is only a preferred embodiment and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (9)

1. A method of displaying data, comprising:
step 1, acquiring target data to be displayed, wherein the type of the target data at least comprises a text and an image;
the method comprises the steps that a text to be displayed is obtained through a self-defined addText () method, and an image to be displayed is obtained through a self-defined addImage (); when the text is acquired through the self-defined addText () method, the text to be displayed and the response identifier are transmitted as parameters, when the image is acquired through the self-defined addImage (), the image to be displayed and the response identifier can be transmitted as parameters, and the target data with the response identifier of true is stored into a clickblelist set, wherein the response identifier of true represents that the target data can respond to touch operation;
step 2, determining the display coordinates of each target data in a user-defined control according to the display size of each target data;
determining the display coordinates of each target data through an onMeasure () method, and storing the display coordinates by a java bean method, wherein one member variable of the java bean stores an Object type Object of the target data, the other member variable of the java bean stores a display coordinate mBounds of the target data, each target data corresponds to a java bean Object, and each target data corresponds to a java bean Object and is stored in a totalList data set according to the display sequence;
step 3, displaying each target data in the one custom control according to the display coordinate of each target data, including: based on the type of target data, drawing each javabean object in the totalList data set according to the display coordinates of each target data through an onDraw method of the self-defined control, calling canvas.
After the step 3, further comprising:
for target data displayed in the custom control, when touch operation on any target data is detected and the target data has a response function, responding to the touch operation based on the target data;
wherein whether the target data has a response function is determined by whether the target data is in a clickabelist set.
2. The method of claim 1, wherein the display size comprises at least a display width and a display height, and the step 2 further comprises:
step 21, determining the number of rows of each target data in the custom control according to the display width of each target data and the width of the custom control based on the display sequence of each target data;
and step 22, determining the display coordinate of each target data in the user-defined control according to the line number, the display width and the display height of each target data.
3. The method of claim 2, wherein the step 21 further comprises:
step 211, accumulating the display width of each target data one by one according to the display order of each target data, and determining the kth row of target data in the custom control according to the accumulation result of the accumulation process, wherein K is a positive integer greater than 0;
and step 212, determining the next target data after the K-th row of target data based on the display sequence of each target data, starting from the next target data, changing to the next row, and repeating the accumulation and determination process until the row number of each target data in the custom control is determined.
4. The method according to claim 3, wherein the step 211 of determining the K-th row of target data in the custom control according to the accumulation result of the present accumulation process further comprises:
when the accumulation result is larger than the width of the custom control, all target data except the last target data participating in the accumulation process are used as the K-th row of target data in the custom control;
and when the accumulation result is smaller than or equal to the width of the custom control, taking all target data participating in the accumulation process as the K-th line of target data in the custom control.
5. The method of claim 2 or 3, wherein the step 22 further comprises:
step 221, for the target data in the K-th row in the custom control, determining a row height corresponding to the target data in the K-th row according to the display height of each target data in the K-th row;
step 222, determining the display coordinates of each target data in the line K +1 in the custom control according to the display order, the display width and the display height of the target data in the line K +1 and the line height corresponding to the target data in the line K based on the view coordinate system.
6. The method of claim 5, wherein the step 221 further comprises:
and comparing the display height of each target data in the K-th row of target data, determining the maximum display height of the K-th row of target data, and taking the maximum display height as the row height corresponding to the K-th row of target data.
7. The method of claim 2 or 3, wherein the step 22 further comprises:
and for the target data of the K-th row in the custom control, when K is equal to 1, determining the display coordinate of each target data of the 1 st row in the custom control according to the display sequence, the display width and the display height of the target data of the 1 st row based on a view coordinate system.
8. The method of claim 1, wherein the step 3 further comprises:
and drawing each target data in the self-defined control according to the display coordinate of each target data based on the type of the target data.
9. A data display device, comprising:
the acquisition module is used for acquiring target data to be displayed, the type of the target data at least comprises a text and an image, and the acquisition module comprises: acquiring a text to be displayed by a self-defined addText () method, and acquiring an image to be displayed by a self-defined addImage (); when the text is acquired through the self-defined addText () method, the text to be displayed and the response identifier are transmitted as parameters, when the image is acquired through the self-defined addImage (), the image to be displayed and the response identifier can be transmitted as parameters, and the target data with the response identifier of true is stored into a clickblelist set, wherein the response identifier of true represents that the target data can respond to touch operation;
the determining module is used for determining the display coordinates of each target data in a user-defined control according to the display size of each target data, and comprises the following steps: determining the display coordinates of each target data by an onMeasure () method, and storing the display coordinates by a java bean method, wherein one member variable of the java bean stores an Object type Object of the target data, the other member variable of the java bean stores a display coordinate mBounds of the target data, each target data corresponds to a java bean Object, and each target data corresponds to a java bean Object and is stored in a totalList data set according to the display sequence;
a display module, configured to display each target data in the one custom control according to the display coordinate of each target data, including: based on the type of target data, drawing each javabean object in the totalList data set according to the display coordinates of each target data through an onDraw method of the self-defined control, calling canvas.
The device further comprises:
the response module is used for responding to the touch operation of the target data displayed in the custom control based on any target data when the touch operation of any target data is detected and the any target data has a response function; wherein whether the target data has a response function is determined by whether the target data is in a clickabelist set.
CN201710199263.3A 2017-03-29 2017-03-29 Data display method and device Active CN107122104B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710199263.3A CN107122104B (en) 2017-03-29 2017-03-29 Data display method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710199263.3A CN107122104B (en) 2017-03-29 2017-03-29 Data display method and device

Publications (2)

Publication Number Publication Date
CN107122104A CN107122104A (en) 2017-09-01
CN107122104B true CN107122104B (en) 2020-10-16

Family

ID=59717401

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710199263.3A Active CN107122104B (en) 2017-03-29 2017-03-29 Data display method and device

Country Status (1)

Country Link
CN (1) CN107122104B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107643916A (en) * 2017-10-09 2018-01-30 武汉斗鱼网络科技有限公司 Control control method, device, electronic equipment and readable storage medium storing program for executing
CN108121584A (en) * 2017-12-20 2018-06-05 北京酷我科技有限公司 A kind of method shown from right to left
CN108363571B (en) * 2018-01-02 2022-02-18 武汉斗鱼网络科技有限公司 Control layout method and system based on intelligent filtering
CN113986426B (en) * 2021-10-26 2024-04-09 腾讯科技(深圳)有限公司 Image detection method and device, readable medium and electronic equipment

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101183358A (en) * 2007-12-25 2008-05-21 北京方正国际软件系统有限公司 Typesetting method and apparatus
CN101923723B (en) * 2009-06-16 2012-11-28 汉王科技股份有限公司 Method for realizing display of electronic document
CN102902678B (en) * 2011-07-26 2015-09-16 腾讯科技(深圳)有限公司 Content of text composition method and terminal
CN103777868B (en) * 2012-10-23 2016-08-24 福建星网视易信息系统有限公司 A kind of in units of the page and there is backstage load and the method that swipes of cache logic
CN105975462A (en) * 2015-09-11 2016-09-28 乐视致新电子科技(天津)有限公司 Method and device for displaying web page and intelligent television system
CN105872706A (en) * 2015-12-30 2016-08-17 乐视致新电子科技(天津)有限公司 Display control method and device

Also Published As

Publication number Publication date
CN107122104A (en) 2017-09-01

Similar Documents

Publication Publication Date Title
CN107168712B (en) Interface drawing method, mobile terminal and computer readable storage medium
CN107122104B (en) Data display method and device
US20170277388A1 (en) Method for Displaying Interface Content and User Equipment
CN107943363B (en) Background image configuration method and device, interactive intelligent panel and storage medium
EP2874054B1 (en) Application text adjusting method, device, and terminal
US9959652B2 (en) Display method and terminal
CN104820589B (en) A kind of method and its device of dynamic adaptation webpage
CN106658139B (en) Focus control method and device
EP3822758B1 (en) Method and apparatus for setting background of ui control
CN111190672A (en) UI (user interface) adaptation method of electronic equipment, electronic equipment and storage medium
CN113010252B (en) Application page display method, electronic equipment and storage medium
EP4068120A1 (en) Message management system and method for communication application, and presentation terminal
CN113268303A (en) Interface element configuration method and device, storage medium and electronic equipment
CN110471700B (en) Graphic processing method, apparatus, storage medium and electronic device
US20170169042A1 (en) Webpage display method, mobile terminal, intelligent terminal, computer program and storage medium
CN108108417B (en) Cross-platform adaptive control interaction method, system, equipment and storage medium
CN103902294A (en) Browser image display method and terminal
CN110413167B (en) Screen capturing method of terminal equipment and terminal equipment
CN106535002B (en) Desktop starter template layout updating method and device
CN115795203B (en) Method and device for constructing menu page, electronic equipment and storage medium
CN111931708A (en) Form generation method and device
CN109683798B (en) Text determination method, terminal and computer readable storage medium
JP6287498B2 (en) Electronic whiteboard device, electronic whiteboard input support method, and program
CN108681531B (en) Document input control method and device
CN113835806A (en) Page layout method and device, electronic equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20230512

Address after: Room 1901, Building 1, No. 32 Dazhou Road, Yuhuatai District, Nanjing City, Jiangsu Province, 210000

Patentee after: Jiangsu Jili Information Technology Co.,Ltd.

Address before: 430000 East Lake Development Zone, Wuhan City, Hubei Province, No. 1 Software Park East Road 4.1 Phase B1 Building 11 Building

Patentee before: WUHAN DOUYU NETWORK TECHNOLOGY Co.,Ltd.

TR01 Transfer of patent right