CN109117237B - Bullet screen display method and device and electronic equipment - Google Patents

Bullet screen display method and device and electronic equipment Download PDF

Info

Publication number
CN109117237B
CN109117237B CN201811029856.6A CN201811029856A CN109117237B CN 109117237 B CN109117237 B CN 109117237B CN 201811029856 A CN201811029856 A CN 201811029856A CN 109117237 B CN109117237 B CN 109117237B
Authority
CN
China
Prior art keywords
bullet screen
textview
control
screen
information
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
CN201811029856.6A
Other languages
Chinese (zh)
Other versions
CN109117237A (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.)
Wuhan Douyu Network 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 CN201811029856.6A priority Critical patent/CN109117237B/en
Publication of CN109117237A publication Critical patent/CN109117237A/en
Application granted granted Critical
Publication of CN109117237B publication Critical patent/CN109117237B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • 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/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

The embodiment of the invention discloses a bullet screen display method and device and electronic equipment. The method provided by the embodiment of the invention comprises the following steps: constructing a view control; filling style information related to the bullet screen in the view control; initializing the position information of the view control; obtaining a layout parameter object; setting bullet screen layout position information according to the layout parameter object; adding bullet screen layout position information into the view control; adding the view control into a preset bullet screen container object; acquiring a bullet screen display setting instruction of a user; and adjusting the height position information of the view control in the bullet screen container object according to the instruction, and displaying the bullet screen in the video according to the height position information. The embodiment of the invention can effectively and freely switch the display height of the bullet screen content, supports the personalized setting of bullet screen display, and can normally display the video information on the screen through the switching, so that the bullet screen display is more reasonable.

Description

Bullet screen display method and device and electronic equipment
Technical Field
The invention relates to the technical field of video playing, in particular to a bullet screen display method and device and electronic equipment.
Background
At any time, the network video application is more and more widely developed in various industries due to the progress of network communication technology and the acceleration of broadband networks. The intuitive and vivid high-definition video application can greatly shorten the distance between users, achieve the best communication effect and has relatively lowest cost, thereby being popular among users in various industries.
The barrage is a great characteristic of internet videos. The bullet screen refers to a comment directly appearing on a video, can appear on the video in a special-effect mode of scrolling, staying or even more actions, and is a short comment sent by a person watching the video. "barrage video" as the name implies has a "barrage" of video. Many websites provide the functionality of video delivery barrage.
In the prior art, the bullet screen display mode is generally: each bullet screen information occupies one row, and then after the bullet screen information appears from the left side of the corresponding row, the bullet screen information is displayed in a rolling mode until the bullet screen information disappears from the right side; alternatively, the bullet screen information appears from the right side of the row and disappears by scrolling to the left side.
However, when the bullet screen content is too much, the normal viewing of the video by the user is easily affected. The prior art does not support personalized customization of bullet screen display, and when bullet screen content influences watching, a user can only select to close all bullet screens.
Disclosure of Invention
The embodiment of the invention provides a bullet screen display method, a bullet screen display device and electronic equipment, which support the personalized setting of bullet screen display and enable bullet screen display to be more reasonable.
In a first aspect, the present application provides a bullet screen display method, including:
constructing a view control;
filling style information related to the bullet screen in the view control;
initializing the position information of the view control;
obtaining a layout parameter object;
setting bullet screen layout position information according to the layout parameter object;
adding the bullet screen layout position information to the view control;
adding the view control into a preset bullet screen container object;
acquiring a bullet screen display setting instruction of a user, wherein the instruction comprises bullet screen display area height setting information;
and adjusting the height position information of the view control in the bullet screen container object according to the instruction, and displaying a bullet screen in a video according to the height position information.
In a second aspect, the present application provides a bullet screen display device, comprising:
the construction unit is used for constructing the view control;
the filling unit is used for filling the style information related to the barrage in the view control;
the initialization unit is used for carrying out initialization operation on the position information of the view control;
a first acquisition unit configured to acquire a layout parameter object;
the setting unit is used for setting the bullet screen layout position information according to the layout parameter object;
the adding unit is used for adding the bullet screen layout position information into the view control and adding the view control into a preset bullet screen container object;
the second acquisition unit is used for acquiring a bullet screen display setting instruction of a user, wherein the instruction comprises bullet screen display area height setting information;
and the display unit is used for adjusting the height position information of the view control in the bullet screen container object according to the instruction and displaying the bullet screen in the video according to the height position information.
In a third aspect, the present invention also provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the computer program may implement the method of any of the first aspects.
The embodiment of the invention constructs the view control; filling style information related to the bullet screen in the view control; initializing the position information of the view control; obtaining a layout parameter object; setting bullet screen layout position information according to the layout parameter object; adding bullet screen layout position information into the view control; adding the view control into a preset bullet screen container object; acquiring a bullet screen display setting instruction of a user; and adjusting the height position information of the view control in the bullet screen container object according to the instruction, and displaying the bullet screen in the video according to the height position information. The embodiment of the invention can effectively and freely switch the display height of the bullet screen content, supports the personalized setting of bullet screen display, and can normally display the video information on the screen through the switching, so that the bullet screen display is more reasonable.
Drawings
Fig. 1 is a schematic diagram of an embodiment of a bullet screen display method in an embodiment of the present invention;
fig. 2 is a schematic diagram of another embodiment of the bullet screen display method in the embodiment of the present invention;
fig. 3 is a schematic diagram of another embodiment of the bullet screen display method in the embodiment of the present invention;
fig. 4 is a schematic diagram of another embodiment of the bullet screen display method in the embodiment of the present invention;
fig. 5 is a schematic diagram of another embodiment of the bullet screen display method in the embodiment of the present invention;
fig. 6 is a schematic diagram of an embodiment of a bullet screen display device in an embodiment of the present invention;
fig. 7 is a schematic view of another embodiment of the bullet screen display device in the embodiment of the invention;
fig. 8 is a schematic view of another embodiment of the bullet screen display device in the embodiment of the invention;
fig. 9 is a schematic diagram of an embodiment of an electronic device in an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The bullet screen display method in the embodiment of the invention is applied to the bullet screen display device, the bullet screen display device is positioned in electronic equipment, and the electronic equipment can be electronic equipment such as a mobile phone, a tablet personal computer or a personal computer, and can also be electronic equipment of a display screen in the future.
Referring to fig. 1, an embodiment of a bullet screen display method according to an embodiment of the present invention includes:
s101, constructing a view control;
when the screen bullet screen is realized, firstly, a view control needs to be dynamically constructed, and the bullet screen is usually text information, so that the screen bullet screen text information can be dynamically constructed through a TextView control in an Android system, namely, the TextView is called to construct an empty textView control, and specifically, the TextView is called to construct an empty textView control, namely, new textView ().
And S102, filling style information related to the bullet screen in the view control.
After the view control is constructed, the newly constructed view control needs to be filled with style information related to a bullet screen next, and further, filling the style information related to the bullet screen in the view control includes: setting the text information of the bullet screen information to be a preset color by calling textView.setTextColor in the textView control; setting a font to be a preset size by calling textView. Setting specific bullet screen content information by calling textView. Setsize (15sp) sets the font to 15sp size by calling textview. And filling the style information of the dynamically constructed barrage information textView control. After the textView control is built, the control needs to be added into the bullet screen area, and for convenience of description, a container of bullet screen content is marked as danmuContainer, and specific bullet screen information content is contained in the danmuContainer.
And S103, initializing the position information of the view control.
Before adding the textView control in the danmuContainer container, the position information of the textView control needs to be initialized correspondingly.
And S104, acquiring a layout parameter object.
The obtaining of the layout parameter object includes: a layout parameter object params of the ViewGroup is obtained by calling the view group.
And S105, setting bullet screen layout position information according to the layout parameter object.
Specifically, the setting of the bullet screen layout position information according to the layout parameter object includes: calling a params.width in the params object to view group.layout params.wrap _ content T to set the width information to the size of the package content, namely the width can be dynamically changed along with the length of the font; similarly, the height information is set as the package CONTENT through the parameter of the parameter object, and the height information of the text is dynamically adapted.
And S106, adding the bullet screen layout position information into the view control.
After setting the bullet screen layout position information, applying the set bullet screen layout position information to a dynamically constructed textView control by calling a textView.
And S107, adding the view control into a preset bullet screen container object.
Specifically, the dynamically built textView control is added to the bullet screen container object danmuContainer by calling danmuContainer.
And S108, acquiring a bullet screen display setting instruction of the user.
Specifically, the setting information of the height of the bullet screen display area is included in the instruction, the setting information of the height of the bullet screen display area includes the setting information of the height of the bullet screen display area, for example, the bullet screen display is switched from a full screen to a half screen, the full screen height of the bullet screen is danmuHeight, and then the height information of the bullet screen display area in the setting information of the height of the bullet screen display area is danmuHeight/2.
In the embodiment of the present invention, the entire height information of the bullet screen container is obtained by calling danmuContainer. getheight () in the danmuContainer, and in general, the height information of the danmuContainer and the height information of the video window are completely the same, and the value of the danmuContainer. getheight () is marked as danmuHeight in the embodiment of the present invention; next, a Random number generator Random is constructed by calling a Random function, specifically, a Random number generator Random is constructed by calling Random new (), a height information between 0 and danmu height is obtained by calling Random. Next, the height position information of the generated textView control in the parent layout danmuContainer needs to be dynamically changed, specifically, the position information of the textView control from the top in the parent layout is set by calling params. The following is a general animation effect, and the control is moved from one side of the screen to the other side.
And S109, adjusting the height position information of the view control in the bullet screen container object according to the instruction, and displaying the bullet screen in the video according to the height position information.
Also taking switching of the full screen and the half screen as an example, the button for switching the full screen and the half screen is assumed to be defined as a button, and one piece of listener information is set for the button by setting a clicked listener for the button, specifically by calling a button. The callback function of the listener is triggered back when the user clicks the button. The invention dynamically modifies the value information of danmuHeight in the callback function, specifically by calling danmuHeight to danmuHeight/2, so that the value information of danmuHeight is half of the original value. When the logic is executed again, the position information of the barrage can only occupy a random value within half of the original screen, so that the switching work of the half-screen barrage is completed. If the user clicks the button again while the half screen pops, it is only necessary to restore it to the full screen state by calling the method of danmuHeight 2. Therefore, the switching method from the full screen to the half screen bullet screen and from the half screen bullet screen to the full screen bullet screen is completed, and the bullet screen in the video is displayed according to the height position information.
The embodiment of the invention constructs the view control; filling style information related to the bullet screen in the view control; initializing the position information of the view control; obtaining a layout parameter object; setting bullet screen layout position information according to the layout parameter object; adding bullet screen layout position information into the view control; adding the view control into a preset bullet screen container object; acquiring a bullet screen display setting instruction of a user; and adjusting the height position information of the view control in the bullet screen container object according to the instruction, and displaying the bullet screen in the video according to the height position information. The embodiment of the invention can effectively and freely switch the display height of the bullet screen content, supports the personalized setting of bullet screen display, and can normally display the video information on the screen through the switching, so that the bullet screen display is more reasonable.
The problem that such an intermediate state exists in the bullet screen switching process is that if a bullet screen executes animation on a lower setting part of the screen, for example, full screen half screen switching is taken as an example, when a button switched to a half screen bullet screen state is clicked, only a new bullet screen is within a half screen, but the bullet screen currently being executed cannot be displayed within the half screen, so that a user may need to wait for a short period of time to be able to display the half screen bullet screen after clicking the half screen bullet screen button, and thus the whole user experience is deteriorated, and the user feels that the half screen bullet screen is clicked and cannot be taken effect immediately, but the bullet screen can take effect after a period of time.
The embodiment of the invention provides a set of solutions for solving the problems, the problem of low switching speed can be effectively solved through the method, and the currently displayed content can be automatically switched to be within the set display range when a user clicks a half-screen bullet screen. Referring to fig. 2, another embodiment of the bullet screen display method in the embodiment of the present invention includes:
s201, a management queue for displaying the bullet screen is constructed.
Specifically, a management Queue for displaying the bullet screen is constructed, the management Queue is used for maintaining the bullet screen information currently displayed in the middle of the screen, the constructed management Queue information is Queue < String > danmu showqueue, and then the initialization operation needs to be performed on the bullet screen Queue danmu showqueue currently displayed, and a specific initialization method is danmu showqueue ═ new Queue < String >.
S202, establishing a corresponding relation between the bullet screen textView control and the unique identifier of the bullet screen.
The management queue danmuShowQueue constructed in the above stores String type data, the bullet screen information in the conventional scheme is a textView control, if the real bullet screen textView control information is cached in the management queue, the memory overhead of the textView control is large, so that the memory overhead of the danmuShowQueue is very large, but in order to ensure the maintenance of the bullet screen information, the embodiment of the invention stores a unique identifier hashCode of the bullet screen, and the unique identifier hashCode is String type data. Because the memory overhead of the unique identifier hashCode of the bullet screen is very small, the corresponding relation between the textView control of the bullet screen and the unique identifier hashCode can be effectively established.
S203, when the bullet screen is ready to enter the screen to execute the mobile animation, acquiring a unique identifier of the bullet screen corresponding to the textView control displayed by the current screen;
specifically, when the bullet screen is ready to enter the screen to execute the moving animation, the hashCode in the textView object is obtained, and specifically, the unique bullet screen identifier tvHashCode corresponding to the textView control displayed on the current screen is obtained by calling a textView.
S204, storing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into a management queue.
And calling danmuShowQueue.add (tvHashCode) in the danmuShowQueue queue to store the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into the danmuShowQueue queue.
S205, when the textView control displayed on the current screen moves out of the screen, moving the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen out of the management queue.
Specifically, when the textView control displayed on the current screen moves out of the screen, the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen is removed from the d anmu ShowQueue queue by calling danmu S howQueue.
In the embodiment of the invention, when a plurality of barrages are displayed on the screen, data are added and removed from the danm uShowQueue queue according to the sequence, and the basic barrage information runs at a constant speed, so that the data which come first can be lost from the screen. Through dynamic addition and deletion, the data in the final d anmunShowQueue is always the bullet screen content being displayed in the current screen.
S206, acquiring a bullet screen display setting instruction of the user, wherein the instruction comprises bullet screen display area height setting information.
The implementation process of this step may specifically refer to the content described in step S108.
S207, taking out all target unique identifiers corresponding to currently displayed barrage textView controls from the management queue according to the instruction, and finding the corresponding target textView controls through the target unique identifiers.
Specifically, all the target unique identifier information corresponding to the textV iew control currently being displayed is taken out from the danmu ShowQueue queue, and the corresponding target textView control is found through the unique identifier information of the bullet screen.
S208, acquiring the current height position information of the target textView control in the bullet screen container object.
Specifically, the obtaining of the current height position information of the target textView control in the bullet screen container object includes: calling textView in the target textView control, getLayoutParams () to obtain layout parameter information params of the target textView control; height position information of the target textView control in the bullet screen container object is obtained by calling params.g. etHeight () in params.
S209, adjusting the height position information of the target textView control in the bullet screen container object according to the height setting information of the bullet screen display area and the current height position information of the target textView control in the bullet screen container object;
s210, displaying the bullet screen in the video according to the height position information of the adjusted target textView control in the bullet screen container object.
Taking the example that the popup display is switched from the full screen to the half screen, when detecting that the user clicks the state of switching the half screen, that is, receiving a popup display setting instruction of the user, all hash code information of currently displayed popup view needs to be taken out from a danmu ShowQueue pair, finding a corresponding textView control through the hash code, then calling textView.getLayoutParams () in the textView control to obtain layout parameter information params of the textView control, then calling a params.getHeight () method in the params to obtain height information of the textView, and marking the height information as tvHeight.
Then, the value information of tvHeight is changed to half of the original value by tvHeight ═ tvHeight/2. And (3) storing new tvHeight value information into the params by calling a params.height ═ tvHeight method in the obtained params object, and setting new layout information into a textView control by calling textView.setLayoutParams (params) in the textView object, so that the height information of the textView control becomes half of the original height information, and the whole bullet screen becomes the target of the half-screen bullet screen.
According to the embodiment of the invention, the corresponding textView control is found through the unique identifier, so that the bullet screen is rapidly switched to take effect, the problem of low switching speed can be effectively solved, all the currently displayed contents are automatically switched to the set height range for displaying after the user clicks the set height of the bullet screen, and the bullet screen display switching efficiency is high.
The default condition for implementation in the embodiment shown in fig. 2 is that the bullet screen runs at a constant speed, so that the accuracy of the data in the danmu showqueue can be guaranteed. However, the requirement is always changed, and the scheme cannot be normally executed when the moving speed of the bullet screen is not constant. Therefore, the embodiment of the invention also provides a bullet screen display method, which solves the problem of how to maintain bullet screen data under the condition of non-uniform speed in the scheme.
Please refer to fig. 3, which is a schematic diagram of another embodiment of a bullet screen display method according to an embodiment of the present invention, the method includes:
s301, defining a List set.
Since the danmuShowQueue in the above scheme is a queue, and the data structure of the queue has a sequence, which is not very suitable for implementation and development of the scheme algorithm in this embodiment, the data set is designed without using the danmuShowQueue, but instead, a set List is used to store currently running bullet screen information, that is, the List set is used to store currently running bullet screen information.
Defining a List set, wherein the specific defining method is List < String > listDanmu, and the listDanmu is the List set, and then initializing the listDanmu set, wherein the specific initializing method is to initialize the listDanmu set by calling the listDanmu ═ new List < String > () method.
S302, constructing a Map variable, and constructing a mapping relation between a barrage TextView control and a unique identifier of the barrage in a codeToTextView set of the Map variable.
Wherein, the only identifier of the bullet screen is data of a String type.
Constructing a Map variable: private Map < TextView, String > codeToTextView;
and constructing a mapping relation between a TextView control and a unique identifier hashCode of the bullet screen inside the Map variable codeToTextView set.
In addition, before the codeToTextView set is used, an initialization operation needs to be performed on the codeToTextView set first, and specifically, a method for initializing the codeToTextView set is realized by calling new HashMap < TextView, String > ().
S303, when the bullet screen is ready to enter the screen to execute the moving animation, acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen, and adding the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into the List set.
When a bullet screen is ready to enter a screen to execute moving animation, namely when a textView control needs to be displayed on the screen, firstly, a textView.
Adding the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into the Li st set, wherein the unique identifier comprises the following steps: add the unique identifier of the bullet screen corresponding to the text View control currently displayed on the screen to the List set by calling listdanmu.
S304, storing the mapping relation between the textView control displayed on the current screen and the unique identifier of the bullet screen into a codeToTextView set.
Specifically, the storing the mapping relationship between the textView control displayed on the current screen and the unique identifier of the bullet screen into the codeToTextView set includes: put (t extView, tvHashCode) method is called to store the mapping relation between the textView control displayed on the current screen and the unique identifier of the bullet screen into the codeToTextView set.
S305, when the textView control displayed on the current screen moves out of the screen, acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen through the mapping relation in the codeToTextView set, and removing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen from the List set.
Specifically, when the textView control displayed on the current screen moves out of the screen, obtaining the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen through the mapping relationship in the codeTo textView set, and removing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen from the List set, including: when the textView control displayed on the current screen moves out of the screen, acquiring a unique identifier of a bullet screen corresponding to the textView control displayed on the current screen by calling codeToTextView.
Remove the unique identifier of the bullet corresponding to the textView control of the current screen display from the list set by calling listDanmu.
It can be seen from the implementation manner that whichever textView control is moved out, the hashCode corresponding to the textView control is moved out from the listDanmu set, so that the problem of sequentiality in the management team in the scheme is avoided, the accuracy of the data in the listDanmu set is effectively ensured, and the speed of the bullet screen does not have any influence on the accuracy of the data in the listDanmu set.
S306, acquiring a bullet screen display setting instruction of the user, wherein the instruction comprises bullet screen display area height setting information.
Reference may be made in particular to what is described in the above embodiments.
S307, taking out all target unique identifiers corresponding to currently displayed bullet screen textView controls from the List set according to the instruction, and finding out the corresponding target textView controls through the target unique identifiers;
specifically, the extracting, according to the instruction, all target unique identifiers corresponding to currently displayed bullet screen textView controls from the List set, and finding corresponding target textView controls by the target unique identifiers includes: and taking out the target unique identifier information corresponding to all the currently displayed text View controls from the list set, and finding the corresponding target text View controls according to the unique identifier information of the bullet screen.
S308, acquiring the current height position information of the target textView control in the bullet screen container object.
Specifically, the obtaining of the current height position information of the target textView control in the bullet screen container object includes: calling textView in the target textView control, getLayoutParams () to obtain layout parameter information params of the target textView control; get the height position information of the target textView control in the bullet screen container object by calling p arm.
S309, adjusting the height position information of the target textView control in the bullet screen container object according to the height setting information of the bullet screen display area and the current height position information of the target textView control in the bullet screen container object.
S310, displaying the bullet screen in the video according to the height position information of the adjusted target textView control in the bullet screen container object.
The steps S309 and S310 may specifically refer to the contents described in the above embodiments, and are not described herein again.
The embodiment of the invention adopts the set List to store the currently running bullet screen information, thereby effectively ensuring the accuracy of the data in the listDanmu set and having no influence on the accuracy of the data in the set by the speed of the bullet screen.
The foregoing embodiment shown in fig. 2 and the embodiment shown in fig. 3 have an obvious improvement in bullet screen switching speed, but there are some problems that the switching is too abrupt, and suddenly a full screen bullet screen directly flickers into a half screen bullet screen effect, so that a person feels that the display screen flickers, which is very unfriendly to the user experience of the user, and a more friendly switching transition mode is further provided in the embodiment of the present invention, and a more natural transition switching method is provided under the condition of ensuring the switching speed, specifically referring to fig. 4, which is another embodiment of the bullet screen display method in the embodiment of the present invention, and the method includes:
s401, a management queue for displaying the bullet screen is constructed.
The management queue is used for maintaining bullet screen information displayed in the middle of a current screen; the constructed management Queue information is Queue < String > danmu showqueue, and then the currently displayed barrage Queue danmu showqueue needs to be initialized, wherein the specific initialization method is danmu showqueue < String >.
S402, establishing a corresponding relation between the bullet screen textView control and the unique identifier of the bullet screen.
The management queue danmuShowQueue constructed in the above stores String type data, the bullet screen information in the conventional scheme is a textView control, if the real bullet screen textView control information is cached in the management queue, the memory overhead of the textView control is large, so that the memory overhead of the danmuShowQueue is very large, but in order to ensure the maintenance of the bullet screen information, the embodiment of the invention stores a unique identifier hashCode of the bullet screen, and the unique identifier hashCode is String type data.
Because the memory overhead of the unique identifier hashCode of the bullet screen is very small, the corresponding relation between the textView control of the bullet screen and the unique identifier hashCode can be effectively established.
S403, when the bullet screen is ready to enter the screen to execute the moving animation, acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen.
Specifically, when the bullet screen is ready to enter the screen to execute the moving animation, the hashCode in the textView object is obtained, and specifically, the unique bullet screen identifier tvHashCode corresponding to the textView control displayed on the current screen is obtained by calling a textView.
S404, storing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into a management queue.
Specifically, when the bullet screen is ready to enter the screen to execute the moving animation, the hashCode in the textView object is obtained, and specifically, the unique bullet screen identifier tvHashCode corresponding to the textView control displayed on the current screen is obtained by calling a textView.
S405, when the textView control displayed on the current screen moves out of the screen, moving the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen out of the management queue.
Specifically, when the textView control displayed on the current screen moves out of the screen, the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen is removed from the d anmu ShowQueue queue by calling danmu S howQueue.
In the embodiment of the invention, when a plurality of barrages are displayed on the screen, data are added and removed from the danm uShowQueue queue according to the sequence, and the basic barrage information runs at a constant speed, so that the data which come first can be lost from the screen. Through dynamic addition and deletion, the data in the final d anmunShowQueue is always the bullet screen content being displayed in the current screen.
S406, acquiring a bullet screen display setting instruction of a user; taking out the target unique identifier corresponding to all currently displayed barrage textView controls from the management queue according to the instruction, and finding the corresponding target textView controls through the target unique identifier;
specifically, the description in steps S206 and S207 may be referred to, and will not be described herein.
S407, setting the horizontal movement distance Sx of the target textView control on the screen.
In order to realize smooth switching to the half-screen bullet screen, it is expected that the entire switching process is completed while horizontally moving by a distance of Sx at the time of design. Wherein Sx is a threshold value which must be smaller than the width of the screen, and the excessive smoothness can be indirectly adjusted by adjusting the distance of Sx.
And S408, marking the horizontal moving speed of the bullet screen as Vx, and calculating the time dT of the smooth change of the bullet screen through Sx/Vx.
Specifically, the moving speed of the bullet screen is usually determined, and the horizontal moving speed of the bullet screen is marked as Vx, so that the smoothly varying time dT can be calculated by Sx/Vx.
And S409, calculating the vertical distance and the vertical speed Vy of movement in the dT time according to the bullet screen display area height setting information.
Taking the example of switching the bullet screen from full screen to half screen, the distance to be converted for the vertical direction is tvHeight-tvHeight/2, that is, the vertical distance to be completed in the time of dT is tvHeight/2, so the vertical movement speed can be calculated to be tvHeight/2dT, and we mark the speed as Vy.
According to the relation of physical speed, the speed is decomposed into 2 directions of Vx and Vy, and then the real direction of the movement of the whole textView control is the oblique line direction. That is, the motion trajectory of the final textView control will be a uniform oblique line motion, so that the problem of directly switching to 1/2-high flashing does not occur.
S410, acquiring a horizontal animation preset by a target textView control, and constructing a vertical animation for the target textView control according to the dT and the Vy; defining a combined animation, and adding the horizontal animation and the vertical animation to an object of the combined animation.
In this embodiment, a preset horizontal animation of the target textView control is obtained, and a specific obtaining manner is that the current horizontal animation animX can be obtained by calling textView.
As Vy and dT are obtained, a longitudinally moving animation can be added to the textView control, and the specific animation construction process is to define an objectAnamator type mAnimatranslateY object. Specifically, constructing a vertical animation for the target textView control according to dT and Vy comprises the following steps:
defining a m animatatortranslatiey object of the object identifier type;
calling object identifier of (orthogonal view, "translation y", tvHeight t ') to construct a vertical animation with a motion speed Vy, wherein the object identifier of (orthogonal view) function is to execute a vertical animation on a target textView control, the starting point of the vertical animation is tvHeight, the target end point is tvHeight', and the return value is the information of the matimatorrranslatitey object;
set the execution period of the vertical animation dT into the object, animatatortranslatiey (dT), by calling animatatortranslatiey in the animatatortlatiey object.
In the embodiment of the present invention, a combined animation animoset needs to be defined, and the animoset is initialized by calling a constructor in the animoset, specifically, by calling animoset ═ new animoset (). And then call animset.add (animX) and animset.add (manimatatortranslatiey), thus adding both horizontal and vertical animations to the animSet object.
S411, starting execution of the horizontal animation and the vertical animation by calling the combined animation, and realizing bullet screen display based on the target textView control in the video.
And finally, starting the execution of the horizontal animation and the vertical animation by calling an aniset.
The embodiment of the invention adjusts the smoothness degree of the whole switching by adjusting the size of Sx, thereby realizing the aim of smooth switching, and the switching of the bullet screen can be smoother and the bullet screen display is more reasonable.
The above-defined Sx is a fixed value information, when the bullet screen information moves to the end of the approach of the screen, a problem occurs at this time that the remaining distance is smaller than Sx, and at this time, if the bullet screen information is executed according to the above-mentioned implementation manner, the bullet screen cannot move to the set range and is already moved out of the screen, so that the effect that a control logic is abnormal is brought to a human. Specifically, please refer to fig. 5, which is a schematic diagram of another embodiment of a bullet screen display method according to an embodiment of the present invention, the method includes:
s501, a management queue for displaying the bullet screen is constructed.
S502, establishing a corresponding relation between the bullet screen textView control and the unique identifier of the bullet screen.
Wherein, the only identifier of the bullet screen is data of a String type.
S503, when the bullet screen is ready to enter the screen to execute the moving animation, acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen.
S504, storing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into a management queue.
And S505, when the textView control displayed on the current screen moves out of the screen, moving the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen out of the management queue.
S506, acquiring a bullet screen display setting instruction of a user, taking out all target unique identifiers corresponding to currently displayed bullet screen textView controls from the management queue according to the instruction, and finding the corresponding target textView controls according to the target unique identifiers.
S507, setting the horizontal movement distance Sx of the target textView control on the screen.
In this embodiment, steps S501 to S507 may refer to specific implementation processes in steps S401 to S407 in the embodiment shown in fig. 4, and details are not described here.
S508, calculating the realtyDistance of the distance which the target textView control needs to move out of the screen completely.
When a user clicks a bullet screen switching button, firstly acquiring the current position information of a textView control, specifically acquiring layout parameter information layout parameters of the current textView control by calling textView.
The textView control has width information of itself, the obtained position information is usually the position information of the upper left corner of the textView control, so the example of completely removing the view is to add the length information of the textView control, and the length information of the textView control is obtained by calling textView. getWidth () in the textView control, where the length information is marked as textViewWidth.
The distance that the current textView control needs to move completely out of the screen is textViewX + textViewWidth, which is specifically labeled reallDistance here.
S509, comparing the size between Sx and reallDistance, if the value of Sx is larger than the value of reallDistance, marking the horizontal moving speed of the bullet screen as Vx, and calculating the time dT of smooth change of the bullet screen through reallDistance/Vx.
Specifically, the size information of realtydistance and Sx needs to be compared, and if the value of Sx is greater than the value of realtydistance, we shall take the value of Sx as the standard at this time, and the specific implementation manner is as shown in the embodiment of fig. 4. If the value of Sx is smaller than the value of realyDistance, calculating the time dT' of the smooth change of the bullet screen through Sx/Vx; calculating the vertical distance and the vertical speed Vy 'of movement within the time dT' according to the setting information of the height of the bullet screen display area; acquiring a horizontal animation preset by the target textView control; constructing a second vertical animation for the target textView control according to the dT 'and the Vy'; defining a combined animation, and adding the horizontal animation and the second vertical animation to an object of the combined animation; and starting execution of the horizontal animation and the second vertical animation by calling the combined animation, and realizing bullet screen display based on the target textView control in the video. The specific implementation process can refer to the embodiment shown in fig. 4.
If the value of Sx is larger than the value of reallDistance, the fact that the remaining distance is not enough to move the view into the screen is indicated at this time, therefore, special processing needs to be carried out on the situation, namely, the horizontal moving speed of the bullet screen is marked as Vx, and the time dT of smooth change of the bullet screen is calculated through reallDistance/Vx.
And S510, calculating the vertical distance and the vertical speed Vy moving in the dT' time according to the setting information of the bullet screen display area height.
In this embodiment, also taking a half-screen as an example, obtaining the vertical movement distance tvHeight/2 (the specific obtaining method is the same as that described in the above fig. 4 embodiment), if the vertical speed is tvHeight/2dT, marking the speed as Vy will occur to be just removed to reach within the half-screen, and in this case, the meaning of entering the half-screen is lost already at first, in order to ensure that the view textView control reaches within the half-screen before being removed, therefore, a special process needs to be performed on Vy, and the speed of Vy needs to be increased to 1.5 times of the original speed, that is, 1.5Vy, so that the faster movement of the longitudinal speed can be ensured, and thus, the view can reach inside the half-screen without being moved out.
Besides the increase of the y-axis speed by one bit, the effect can be achieved by reducing the speed of Vx, for example, the speed of Vx can be reduced to half of the original speed, namely 1/2Vx, and the effect is consistent, and even the two effects can be superposed to achieve a more friendly transition experience.
S511, acquiring a horizontal animation preset by the target textView control; constructing a first vertical animation for the target textView control according to the dT and the 1.5 Vy; a combined animation is defined, and a horizontal animation and a first vertical animation are added to an object of the combined animation.
In this embodiment, a preset horizontal animation of the target textView control is obtained, and a specific obtaining manner is that the current horizontal animation animX can be obtained by calling textView.
Constructing a first vertical animation for the target textView control according to dT and 1.5Vy, wherein the first vertical animation comprises the following steps:
defining a m animatatortranslatiey object of the object identifier type;
calling object identifier of (orthogonal view, "translation y", tvHeight t ') to construct a first vertical animation with a motion speed of 1.5Vy, wherein the object identifier of (orthogonal view) function is to execute the first vertical animation on a target textView control, the starting point of the first vertical animation is tvHeight, the target end point is tvHeight', and the returned value is the information of the object of the matimator transform;
set the execution period of the first vertical animation dT into the object, animatatortranslatiey (dT), by calling animatatortranslatiey in the animatatortyobject.
In the embodiment of the present invention, a combined animation animoset needs to be defined, and the animoset is initialized by calling a constructor in the animoset, specifically, by calling animoset ═ new animoset (). And then call animset.add (animX) and animset.add (mannimatatortranslatiney), thus adding both the horizontal animation and the first vertical animation to the animSet object.
S512, the execution of the horizontal animation and the first vertical animation is started by calling the combined animation, and the bullet screen display based on the target textView control is realized in the video.
And finally, starting the execution of the horizontal animation and the first vertical animation by calling an aniset.
In the embodiment of the invention, the sizes of the reallDistance and Sx of the moving distances of the screen are completely removed by comparing the textView control, when the reallDistance is smaller than Sx, the vertical moving speed is adjusted to 1.5Vy, and the nose hair bullet screen can not move to the set range and can already move out of the screen, so that the bullet screen display is more reasonable while the personalized setting of bullet screen display is supported.
The following describes an embodiment of a bullet screen display device according to an embodiment of the present invention.
Referring to fig. 6, which is a schematic view of an embodiment of a bullet screen display device according to an embodiment of the present invention, the device includes:
the building unit 601 is used for building a view control;
a filling unit 602, configured to fill style information related to a bullet screen in the view control;
an initializing unit 603, configured to perform an initializing operation on the position information of the view control;
a first obtaining unit 604 for obtaining a layout parameter object;
a setting unit 605, configured to set bullet screen layout position information according to the layout parameter object;
an adding unit 606, configured to add the bullet screen layout position information to the view control, and add the view control to a preset bullet screen container object;
a second obtaining unit 607, configured to obtain a setting instruction of the bullet screen display of the user, where the instruction includes setting information of the height of the bullet screen display area;
and the display unit 608 is configured to adjust the height position information of the view control in the bullet screen container object according to the instruction, and display a bullet screen in a video according to the height position information.
Optionally, the building unit 601 is specifically configured to:
calling the textView to construct an empty textView control;
the filling unit 602 is specifically configured to:
setting text information of the bullet screen information to a preset color by calling textView. setTextColor in the textView object;
setting a font to be a preset size by calling textView.
Settext sets specific bullet screen content information by calling textview.
Optionally, the first obtaining unit 604 is specifically configured to:
obtaining a layout parameter object params of the Viewgroup by calling a ViewGroup.layout params () method;
the setting unit 605 is specifically configured to:
calling a params.width in the params object, i.e. ViewGroup.layout of params.WRAP _ C ONNTE, to set the width information to the size of the package content;
the height information is set as the wrapping content through the params in the params object, namely, the video group, the layout params, the wrap _ CO NTENT, and the height information of the text is dynamically adapted.
Optionally, the adding unit 606 is specifically configured to:
applying the set bullet screen layout position information params to the textView control by calling textView.
Add View in danmuContainer object is called (textView adds textView control to the bullet screen container object danmuContainer.
Optionally, the display unit 608 is specifically configured to:
acquiring the entire height information danmuHeight of the bullet screen container by calling danmuContainer.getHeight () in the danmuContainer container;
constructing a Random number generator Random by calling Random ();
netfloat (danmu Height) in the random object is called to obtain Height information randomheight between 0 and danmu Height;
and setting position information of the textView control from the top in the father layout by calling a params.marginTop ═ random mHeight method according to the height setting information of the bullet screen display area, so as to adjust the height position information of the bullet screen and display the bullet screen in the video according to the height position information.
Referring to fig. 7, a schematic diagram of another embodiment of a bullet screen display device according to an embodiment of the present invention is shown, the device including:
the constructing unit 701 is configured to construct a management queue for displaying a bullet screen, where the management queue is used to maintain bullet screen information displayed in the middle of a current screen;
the establishing unit 702 is configured to establish a corresponding relationship between a barrage textView control and a unique identifier of a barrage, where the unique identifier of the barrage is String-type data;
the first obtaining unit 703 is configured to obtain a unique identifier of a bullet screen corresponding to a textView control displayed on a current screen when the bullet screen is ready to enter the screen to execute a moving animation;
a queue management unit 704, configured to store a unique identifier of a bullet screen corresponding to a textView control displayed on a current screen into the management queue; when the textView control displayed on the current screen moves out of the screen, moving the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen out of the management queue;
a second obtaining unit 705, configured to obtain a bullet screen display setting instruction of a user, where the instruction includes bullet screen display area height setting information;
a third obtaining unit 706, configured to take out, according to the instruction, a target unique identifier corresponding to all currently-displayed bullet screen textView controls from the management queue, and find a corresponding target textView control through the target unique identifier; acquiring the current height position information of the target textView control in the bullet screen container object;
an adjusting unit 707, configured to adjust height position information of the target textView control in the bullet screen container object according to the bullet screen display area height setting information and the height position information of the target textView control currently in the bullet screen container object;
and the display unit 708 is used for displaying the bullet screen in the video according to the height position information of the adjusted target textView control in the bullet screen container object.
Optionally, the first obtaining unit 703 is specifically configured to: and acquiring the unique identifier tvHashCode of the bullet screen corresponding to the textView control displayed on the current screen by calling the textView.
Optionally, the management queue is a danmu showqueue queue, and the queue management unit 704 is specifically configured to:
calling danmuShowQueue.add (tvHashCode) in the danmuShowQueue queue to store the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into the danmuShowQueue queue;
when the textView control displayed on the current screen moves out of the screen, the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen is removed from the danmuShowQueue queue by calling danmuShowQueue.
Optionally, the third obtaining unit 706 is specifically configured to:
taking out target unique identifier information corresponding to all textView controls currently displayed from the danmuShowQueue queue, and finding out corresponding target textV iew controls through the unique identifier information of the bullet screen;
the obtaining of the height position information of the target textView control currently in the bullet screen container object comprises:
calling textView in the target textView control, getLayoutParams () to obtain layout parameter information params of the target textView control;
get the height position information of the target textView control in the bullet screen container object by calling params.
Referring to fig. 8, a schematic view of another embodiment of a bullet screen display device according to an embodiment of the present invention is shown, the device including:
a defining unit 801, configured to define a List set, where the List set is used to store currently-running bullet screen information;
the constructing unit 802 is configured to construct a Map variable, and construct a mapping relationship between a barrage TextView control and a unique identifier of a barrage within a codeToTextView set of the Map variable, where the unique identifier of the barrage is String-type data;
the adding unit 803 is configured to, when a bullet screen is ready to enter a screen to execute a moving animation, obtain a unique identifier of the bullet screen corresponding to a textView control displayed on a current screen, and add the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen to a List set;
the storage unit 804 is used for storing the mapping relation between the textView control displayed on the current screen and the unique identifier of the bullet screen into a codeToTextView set;
a removing unit 805, configured to, when a textView control displayed on a current screen moves out of the screen, obtain, through a mapping relationship in a codeToTextView set, a unique identifier of a bullet screen corresponding to the textView control displayed on the current screen, and remove, from the List set, the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen;
an obtaining unit 806, configured to obtain a bullet screen display setting instruction of a user, where the instruction includes height setting information of a bullet screen display area; taking out target unique identifiers corresponding to all currently displayed bullet screen textView controls from the List set according to the instruction, and finding corresponding target textView controls through the target unique identifiers; acquiring the current height position information of the target textView control in the bullet screen container object;
an adjusting unit 807, configured to adjust the height position information of the target textView control in the bullet screen container object according to the bullet screen display area height setting information and the height position information of the target textView control currently in the bullet screen container object;
and the display unit 808 is configured to display a bullet screen in a video according to the adjusted height position information of the target textView control in the bullet screen container object.
Optionally, the adding unit 803 is specifically configured to:
and acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen by calling textView.
Optionally, the adding unit 803 is further specifically configured to:
adding the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into the List set by calling listDanmu.
The storage unit 804 is specifically configured to: put (textView, tvHa shCode) method is called to store the mapping relation between the textView control displayed on the current screen and the unique identifier of the bullet screen into the codeToTextView set.
Optionally, the removing unit 805 is specifically configured to: when the textView control displayed on the current screen moves out of the screen, acquiring a unique identifier of a bullet screen corresponding to the textView control displayed on the current screen by calling codeToTextView.
Remove the unique identifier of the bullet corresponding to the textView control of the current screen display from the list set by calling listDanmu.
An embodiment of the present invention further provides an electronic device, please refer to fig. 9, where the electronic device includes:
a memory 901, a processor 902 and a computer program 903 stored on the memory and operable on the processor, wherein the bullet screen display method can be implemented when the processor 902 executes the computer program 903.
It should be noted that the electronic devices related to the present application include, but are not limited to: mobile terminals (cell phones, smart phones, PADs, laptops, etc.), fixed terminals (computers).
For convenience of explanation, only the parts related to the embodiments of the present invention are shown, and details of the specific techniques are not disclosed. The memory 901 may be used to store computer programs 903 including software programs, modules, and data, and the processor 902 executes the computer programs 903 stored in the memory 901 by executing, thereby executing various functional applications of the electronic device and data processing.
The embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium may store a program, and when the program is executed, the program includes some or all of the steps of the bullet screen display method described in the above method embodiments.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention 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 solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (9)

1. A bullet screen display method is characterized by comprising the following steps:
constructing a view control, comprising: calling the textView to construct an empty textView control;
filling style information related to the bullet screen in the view control;
initializing the position information of the view control;
obtaining a layout parameter object;
setting bullet screen layout position information according to the layout parameter object;
adding the bullet screen layout position information to the view control;
adding the view control into a preset bullet screen container object;
acquiring a bullet screen display setting instruction of a user, wherein the instruction comprises bullet screen display area height setting information, and the bullet screen display area height setting information comprises information for setting the height of a bullet screen display area;
taking out all target unique identifiers corresponding to currently displayed bullet screen textView controls from a management queue according to the bullet screen display setting instruction, and finding corresponding target textView controls through the target unique identifiers; setting a horizontal moving distance Sx of a target textView control on a screen, wherein the target textView control is a textView control corresponding to a currently displayed bullet screen; marking the horizontal moving speed of the bullet screen as Vx, and calculating the time dT of the smooth change of the bullet screen through Sx/Vx; calculating the vertical distance and the vertical speed Vy of movement within the dT time according to the height setting information of the bullet screen display area; taking a preset horizontal animation of a target textView control, and constructing a vertical animation for the target textView control according to the dT and Vy; defining a combined animation, and adding the horizontal animation and the vertical animation to an object of the combined animation; starting execution of horizontal animation and vertical animation by calling combined animation, and realizing bullet screen display based on the target textView control in a video; starting execution of horizontal animation and vertical animation by calling combined animation, and realizing bullet screen display based on the target textView control in a video;
before obtaining user's bullet screen display setting instruction, still include: constructing a management queue for displaying the bullet screen; establishing a corresponding relation between the bullet screen textView control and the unique identifier of the bullet screen; when a bullet screen is ready to enter a screen to execute the mobile animation, acquiring a unique identifier of the bullet screen corresponding to a textView control displayed by the current screen; storing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into a management queue; and when the textView control displayed on the current screen moves out of the screen, moving the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen out of the management queue.
2. The method of claim 1,
the filling of style information related to the bullet screen in the view control comprises the following steps:
setting the text information of the bullet screen information to be a preset color by calling textView.setTextColor in the textView control;
setting a font to be a preset size by calling textView.
Settext sets specific bullet screen content information by calling textview.
3. The method of claim 2, wherein said obtaining layout parameter objects comprises:
obtaining a layout parameter object params of the Viewgroup by calling a Viewgroup params = new Viewgroup params () method;
the setting of the bullet screen layout position information according to the layout parameter object comprises the following steps:
calling params.width = viewgroup.layout params.wrap _ CONTENT in the params object to set the width information to the package CONTENT size;
height information is set to package CONTENT through the params in the params object, height = viewgroup, layout params.
4. The method of claim 3, wherein adding the bullet screen layout position information to the view control comprises:
the set bullet screen layout position information params is applied to the textView control by calling textView.
5. The method of claim 4, wherein adding the view control to a preset bullet screen container object comprises:
add View in danmuContainer object is called (textView adds textView control to the bullet screen container object danmuContainer.
6. A bullet screen display device, characterized in that the device comprises:
the building unit is used for building the view control, and is specifically used for: calling the textView to construct an empty textView control;
the filling unit is used for filling the style information related to the barrage in the view control;
the initialization unit is used for carrying out initialization operation on the position information of the view control;
a first acquisition unit configured to acquire a layout parameter object;
the setting unit is used for setting the bullet screen layout position information according to the layout parameter object;
the adding unit is used for adding the bullet screen layout position information into the view control and adding the view control into a preset bullet screen container object;
the second acquisition unit is used for acquiring a bullet screen display setting instruction of a user, wherein the instruction comprises bullet screen display area height setting information, and the bullet screen display area height setting information comprises information for setting the height of a bullet screen display area;
the display unit is used for taking out all target unique identifiers corresponding to currently displayed bullet screen textView controls from the management queue according to the bullet screen display setting instruction, and finding the corresponding target textView controls through the target unique identifiers; setting a horizontal moving distance Sx of a target textView control on a screen, wherein the target textView control is a textView control corresponding to a currently displayed bullet screen; marking the horizontal moving speed of the bullet screen as Vx, and calculating the time dT of the smooth change of the bullet screen through Sx/Vx; calculating the vertical distance and the vertical speed Vy of movement within the dT time according to the height setting information of the bullet screen display area; taking a preset horizontal animation of a target textView control, and constructing a vertical animation for the target textView control according to the dT and Vy; defining a combined animation, and adding the horizontal animation and the vertical animation to an object of the combined animation; starting execution of horizontal animation and vertical animation by calling combined animation, and realizing bullet screen display based on the target textView control in a video; starting execution of horizontal animation and vertical animation by calling combined animation, and realizing bullet screen display based on the target textView control in a video; before obtaining user's bullet screen display setting instruction, still include: constructing a management queue for displaying the bullet screen; establishing a corresponding relation between the bullet screen textView control and the unique identifier of the bullet screen; when a bullet screen is ready to enter a screen to execute the mobile animation, acquiring a unique identifier of the bullet screen corresponding to a textView control displayed by the current screen; storing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into a management queue; and when the textView control displayed on the current screen moves out of the screen, moving the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen out of the management queue.
7. The apparatus of claim 6,
the filling unit is specifically configured to:
setting text information of the bullet screen information to a preset color by calling textView. setTextColor in the textView object;
setting a font to be a preset size by calling textView.
Settext sets specific bullet screen content information by calling textview.
8. The apparatus according to claim 7, wherein the first obtaining unit is specifically configured to:
obtaining a layout parameter object params of the Viewgroup by calling a Viewgroup params = new Viewgroup params () method;
the setting unit is specifically configured to:
calling params.width = viewgroup.layout params.wrap _ CONTENT in the params object to set the width information to the package CONTENT size;
height information is set to package CONTENT through the params in the params object, height = viewgroup, layout params.
9. An electronic device, comprising: memory, processor and computer program stored on the memory and executable on the processor, wherein the processor when executing the computer program may implement the method of any of claims 1 to 5.
CN201811029856.6A 2018-09-05 2018-09-05 Bullet screen display method and device and electronic equipment Active CN109117237B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811029856.6A CN109117237B (en) 2018-09-05 2018-09-05 Bullet screen display method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811029856.6A CN109117237B (en) 2018-09-05 2018-09-05 Bullet screen display method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN109117237A CN109117237A (en) 2019-01-01
CN109117237B true CN109117237B (en) 2021-10-15

Family

ID=64858111

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811029856.6A Active CN109117237B (en) 2018-09-05 2018-09-05 Bullet screen display method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN109117237B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110012306B (en) * 2019-04-02 2021-05-14 广州虎牙信息科技有限公司 Bullet screen display method, device, equipment and storage medium
CN111246270B (en) * 2020-01-14 2022-02-25 广州虎牙科技有限公司 Method, device, equipment and storage medium for displaying bullet screen
CN112581561B (en) * 2020-12-25 2024-07-12 深圳市元征科技股份有限公司 Method, device, electronic equipment and storage medium for creating pin view
CN115988169B (en) * 2023-03-20 2023-08-18 全时云商务服务股份有限公司 Method and device for rapidly displaying real-time video on-screen text in cloud conference

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105847735A (en) * 2016-03-30 2016-08-10 宁波三博电子科技有限公司 Face recognition-based instant pop-up screen video communication method and system
CN105979337A (en) * 2015-12-28 2016-09-28 武汉斗鱼网络科技有限公司 Video comment playing device and method
CN106101802A (en) * 2016-05-31 2016-11-09 武汉斗鱼网络科技有限公司 A kind of barrage input method and device
CN106131641A (en) * 2016-06-30 2016-11-16 乐视控股(北京)有限公司 A kind of barrage control method, system and Android intelligent television

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105979337A (en) * 2015-12-28 2016-09-28 武汉斗鱼网络科技有限公司 Video comment playing device and method
CN105847735A (en) * 2016-03-30 2016-08-10 宁波三博电子科技有限公司 Face recognition-based instant pop-up screen video communication method and system
CN106101802A (en) * 2016-05-31 2016-11-09 武汉斗鱼网络科技有限公司 A kind of barrage input method and device
CN106131641A (en) * 2016-06-30 2016-11-16 乐视控股(北京)有限公司 A kind of barrage control method, system and Android intelligent television

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
android中的弹幕效果;坚持、梦想;《https://blog.csdn.net/u014538437/article/details/49306555》;20150728;第1-5页 *
Android自定义View修炼一自定义弹幕效果View;Jamy Cai;《https://www.cnblogs.com/JczmDeveloper/p/4872460.html》;20151012;第4页 *

Also Published As

Publication number Publication date
CN109117237A (en) 2019-01-01

Similar Documents

Publication Publication Date Title
CN109117237B (en) Bullet screen display method and device and electronic equipment
CN106021421B (en) method and device for accelerating webpage rendering
CN107204044B (en) Picture display method based on virtual reality and related equipment
US20190230311A1 (en) Video interface display method and apparatus
CN108337547B (en) Character animation realization method, device, terminal and storage medium
CN106658139B (en) Focus control method and device
CN112181342A (en) Display method, display device, electronic apparatus, and storage medium
CN103905909A (en) Video preview display method and terminal device
CN108905203B (en) Information processing method, information processing apparatus, storage medium, and electronic apparatus
CN106990962B (en) Dynamic screen locking wallpaper switching method and device and terminal
CN111796825B (en) Bullet screen drawing method, bullet screen drawing device, bullet screen drawing equipment and storage medium
CN112843680A (en) Picture display method and device, terminal equipment and storage medium
CN109388737B (en) Method and device for sending exposure data of content item and storage medium
US20140092084A1 (en) Webpage display method and apparatus
CN107122104B (en) Data display method and device
CN110891190B (en) Bullet screen display method and device and electronic equipment
US20220172440A1 (en) Extended field of view generation for split-rendering for virtual reality streaming
CN104615738A (en) Remote sync based mobile terminal photo sharing method
EP4325344A1 (en) Multi-terminal collaborative display update method and apparatus
CN103678261A (en) Method, device and equipment for rapidly displaying TTFs
CN110881138B (en) Bullet screen display method and device and electronic equipment
CN109361961B (en) Bullet screen display method and device and electronic equipment
CN110881145B (en) Bullet screen display method and device and electronic equipment
CN105163198B (en) A kind of coding method of instant video and electronic equipment
CN109800039B (en) User interface display 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