CN109117237A - A kind of barrage display methods, device and electronic equipment - Google Patents
A kind of barrage display methods, device and electronic equipment Download PDFInfo
- Publication number
- CN109117237A CN109117237A CN201811029856.6A CN201811029856A CN109117237A CN 109117237 A CN109117237 A CN 109117237A CN 201811029856 A CN201811029856 A CN 201811029856A CN 109117237 A CN109117237 A CN 109117237A
- Authority
- CN
- China
- Prior art keywords
- barrage
- textview
- information
- control
- calling
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0481—Interaction 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)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Controls And Circuits For Display Device (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The embodiment of the invention discloses a kind of barrage display methods, device and electronic equipments.The method comprise the steps that building view control;In the relevant style information of view control filling barrage;The location information of view control is initialized;Obtain layout parameter object;According to layout parameter object, barrage placement position information is set;Barrage placement position information is added in view control;View control is added in preset barrage container object;Obtain the barrage display setting instruction of user;According to height position information of the instruction adjustment view control in the barrage container object, barrage in video is shown according to height position information.Barrage content effectively can be shown that height carries out free switching by the embodiment of the present invention, support the personal settings that show of barrage, and switching in this way can make the video information on screen normally be shown so that barrage show it is more reasonable.
Description
Technical field
The present invention relates to field of video broadcasting technology, in particular to a kind of barrage display methods, device and electronic equipment.
Background technique
The speed-raising of the progress of network communication technology and broadband network at any time, network video is applied is got in various industries
Carry out more extensive development.Intuitive and lively HD video application, can greatly further the distance between user, and reach most
Good communicative effect, and cost is relatively minimum, so having obtained the popular welcome of every profession and trade user.
Barrage is a big characteristic of internet video.Barrage refers to the comment being directly apparent on video, can be to roll, stop
It stays even more movement Special effects modes to appear on video, is the brief comment watching the human hair of video and sending." barrage video " cares for
Name Si Yi is the video for having " barrage ".Many websites provide the function that video sends barrage.
In the prior art, barrage display mode is usually: every barrage information occupies a line, and then barrage information is from right
After the left side that should be gone occurs, scrolling display to right side disappears;Alternatively, barrage information occurs from the right side of the row, scrolling display is extremely
Left side disappears.
But when barrage content is excessive, it is easy to influence normal viewing of the user to video.It does not support in the prior art pair
The personalized customization that barrage is shown, when barrage content influences to watch, user can only select to close whole barrages.
Summary of the invention
The embodiment of the invention provides a kind of barrage display methods, device and electronic equipment, the individual character for supporting barrage to show
Change setting so that barrage show it is more reasonable.
In a first aspect, this application provides a kind of barrage display methods, this method comprises:
Construct view control;
In the relevant style information of view control filling barrage;
The location information of the view control is initialized;
Obtain layout parameter object;
According to the layout parameter object, barrage placement position information is set;
The barrage placement position information is added in the view control;
The view control is added in preset barrage container object;
The barrage display setting instruction of user is obtained, includes barrage display area height setting information in described instruction;
Height position information of the view control in the barrage container object is adjusted according to described instruction, according to institute
It states height position information and shows barrage in video.
Second aspect, the application provide a kind of barrage display device, which includes:
Construction unit, for constructing view control;
Fills unit, in the relevant style information of view control filling barrage;
Initialization unit is initialized for the location information to the view control;
First acquisition unit, for obtaining layout parameter object;
Setting unit, for barrage placement position information to be arranged according to the layout parameter object;
Adding unit, for the barrage placement position information to be added in the view control, and by the view
Control is added in preset barrage container object;
Second acquisition unit, the barrage for obtaining user show setting instruction, include barrage viewing area in described instruction
Domain height setting information;
Display unit, for adjusting height position of the view control in the barrage container object according to described instruction
Confidence breath shows barrage in video according to the height position information.
The third aspect, the present invention also provides a kind of electronic equipment, comprising: memory and is stored in the storage at processor
On device and the computer program that can run on the processor, wherein the processor can when executing the computer program
To realize any method in first aspect.
The embodiment of the present invention passes through building view control;In the relevant style information of view control filling barrage;To view
The location information of control initializes;Obtain layout parameter object;Barrage is set according to layout parameter object and is laid out position
Confidence breath;Barrage placement position information is added in view control;View control is added to preset barrage container object
In;Obtain the barrage display setting instruction of user;According to height of the instruction adjustment view control in the barrage container object
Location information shows barrage in video according to height position information.The embodiment of the present invention can effectively show barrage content
Height carries out free switching, and the personal settings for supporting barrage to show, switching in this way can make the video on screen
Information is normally shown so that barrage show it is more reasonable.
Detailed description of the invention
Fig. 1 is one embodiment schematic diagram of barrage display methods in the embodiment of the present invention;
Fig. 2 is another embodiment schematic diagram that the present invention is barrage display methods in embodiment;
Fig. 3 is another embodiment schematic diagram that the present invention is barrage display methods in embodiment;
Fig. 4 is another embodiment schematic diagram that the present invention is barrage display methods in embodiment;
Fig. 5 is another embodiment schematic diagram that the present invention is barrage display methods in embodiment;
Fig. 6 is one embodiment schematic diagram of barrage display device in the embodiment of the present invention;
Fig. 7 is another embodiment schematic diagram of barrage display device in the embodiment of the present invention;
Fig. 8 is another embodiment schematic diagram of barrage display device in the embodiment of the present invention;
Fig. 9 is one embodiment schematic diagram of electronic equipment in the embodiment of the present invention.
Specific embodiment
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention
Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only
The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people
The model that the present invention protects all should belong in member's every other embodiment obtained without making creative work
It encloses.
Barrage display methods is applied to barrage display device in the embodiment of the present invention, which is located in electronic equipment, should
Electronic equipment can be the electronic equipments such as mobile phone, tablet computer or PC, be also possible to following have display screen
Electronic equipment etc..
Referring to Fig. 1, one embodiment of barrage display methods includes: in the embodiment of the present invention
S101, building view control;
Firstly the need of one view control of dynamic construction when realizing screen barrage, barrage is usually a text envelope
Breath, therefore the present invention can be when the dynamic construction barrage text information through the TextView in android system
For control come what is constructed, i.e. calling TextView constructs an empty textView control, specifically, calling TextView
TextView=new TextView () constructs an empty textView control.
S102, the relevant style information of barrage is filled in view control.
After constructing view control, next need to believe the relevant pattern of view control filling barrage of the new building
Breath, it is further, described in the relevant style information of view control filling barrage, comprising: by calling textView control
The text information of barrage information is arranged to pre-set color by the textView.setTextColor in part;Pass through calling
TextView.setSize sets font to preset size;It is arranged in specific barrage by calling textView.setText
Hold information, specifically, for example by calling the textView.setTextColor (Color.WHITE) in textView control
The text information of barrage information is arranged to white;By call textView.setSize (15sp) set font for 15sp it is big
It is small.In this way to the style information filling for the barrage information textView control for just completing dynamic construction.Building is completed above-mentioned
We need for the control to be added in barrage region after textView control, describe us for convenience for the appearance of barrage content
Device is labeled as danmuContainer, subsequent in danmuContainer to contain the specific barrage information content.
S103, the location information of view control is initialized.
Firstly the need of the position to textView control before addition textView control in danmuContainer container
Confidence breath carries out corresponding initialization operation.
S104, layout parameter object is obtained.
The acquisition layout parameter object includes: by calling ViewGroup.layoutParams params=new
ViewGroup.layoutParams () method obtains the layout parameter object params of a ViewGroup.
S105, barrage placement position information is arranged according to layout parameter object.
Specifically, described be arranged barrage placement position information according to the layout parameter object, comprising: call params pairs
Width information is arranged to wrap up by the params.width=ViewGroup.layoutParams.WRAP_CONTEN T as in
Content size, that is to say, that width can become with the length dynamic of font;Similarly, by params object
Elevation information is arranged to contents of parcel by params.height=ViewGroup.layoutParams.WR AP_CONTENT,
The elevation information of dynamic adaptation text.
S106, barrage placement position information is added in view control.
It is arranged after barrage placement position information, by calling textView.setLayoutParams (params) method
By on the textView control of the barrage placement position Information application set to dynamic construction, such textView control just has
For the relevant information in position.
S107, view control is added in preset barrage container object.
Specifically, by calling the danmuContainer.addView (tex in danmuContainer object
TView) the good textView control of dynamic construction is added in barrage container object danmuContainer.
S108, the barrage display setting instruction for obtaining user.
Specifically, including barrage display area height setting information, barrage display area height setting information in the instruction
In include setting barrage display area height information, by barrage show by it is full frame be switched to half screen for, the full frame height of barrage
For danmuHeight, then barrage display area elevation information is danmuHeight/ in barrage display area height setting information
2。
In the embodiment of the present invention, by calling the danmuContainer.getHeight in danmuContainer container
() gets the entire elevation information of barrage container, under normal conditions the elevation information and view of danmuContainer container
The elevation information of frequency window be it is identical, by the value of danmuContainer.getHeight () in the embodiment of the present invention
Labeled as danmuHeight;A random elevation information is obtained followed by a random function is called, particular by
Random random=new Random () is called to construct a random number generator random, by calling random pairs
Random.netFloat (danmuHeight) as in obtains 0 to an elevation information between danmuHeight, we
The elevation information that will acquire is labeled as randomHeight.Next dynamic is needed to change the textView control of above-mentioned generation
It is laid out the height position information in danmuContainer in father, particular by calling params.marginTop=
RandomHeight come be arranged textView control father layout in the location information away from top.Subsequent is exactly general animation effect
Control is moved to other side from screen side, can consider that the realization of the animation effect is one in the embodiment of the present invention by fruit
A prior art does not do excessive description herein.
S109, the height position information according to instruction adjustment view control in barrage container object, according to height and position
Information shows barrage in video.
Equally for switching full frame and half screen, switch full frame and half screen button hypothesis and be defined as button, by for
The monitor that button setting is clicked comes particular by calling button.setOnClickListener method for button
Provided with a monitor information.The call back function of triggering monitor is returned when button when the user clicks.The present invention is adjusting back
The value information that above-mentioned danmuHeight is dynamically modified in function, particular by calling danmuHeight=danmuHeight/
2, the value information of such danmuHeight is exactly original half.When executing above-mentioned logic again, the position of barrage is believed
Breath can only just occupy as a random value within original screen half, and this completes the switch operatings of half screen barrage.Such as
Fruit user again taps on the button when half screen barrage, it is thus only necessary to by calling danmuHeight=
The method of danmuHeight*2 revert to the state of full screen.This completes full frame to half screen barrage and
Half screen barrage is realized to the switching method of full frame barrage and shows barrage in video according to the height position information.
The embodiment of the present invention passes through building view control;In the relevant style information of view control filling barrage;To view
The location information of control initializes;Obtain layout parameter object;Barrage is set according to layout parameter object and is laid out position
Confidence breath;Barrage placement position information is added in view control;View control is added to preset barrage container object
In;Obtain the barrage display setting instruction of user;According to height of the instruction adjustment view control in the barrage container object
Location information shows barrage in video according to height position information.The embodiment of the present invention can effectively show barrage content
Height carries out free switching, and the personal settings for supporting barrage to show, switching in this way can make the video on screen
Information is normally shown so that barrage show it is more reasonable.
If above-mentioned barrage handoff procedure has such a intermediate state, that is exactly a barrage in screen
Lower setting section execute animation when, by taking full frame switching half screen as an example, click the button for being switched to half screen barrage state
In the case where it is necessary, only new barrage is only within half screen, but the barrage being currently executing cannot achieve half screen with
Interior display will lead to also need to wait a bit of time that can show after we click half screen barrage button in this way
Half screen barrage comes out, will lead to entire user experience in this way and is deteriorated, the feeling to user be exactly click half screen barrage cannot
Illusion that is enough to come into force at once, but needing just come into force after a period of time.
A set of solution is given in the embodiment of the present invention regarding to the issue above, can be effectively solved by this method
The slow problem of switch speed, can when the user clicks half screen barrage when automatically by the content being currently displaying all switch
To within the indication range of setting.Referring specifically to Fig. 2, another embodiment packet of barrage display methods in the embodiment of the present invention
It includes:
The management queue of one S201, building display barrage.
Specifically, the management queue of one display barrage of building, the management queue is aobvious among current positive screen for safeguarding
The barrage information shown, the management queuing message of building are Queue<String>danmuShowQueue, next needs pair
The barrage queue danmuShowQueue being currently displaying is initialized, and specific initial method is
DanmuShowQueue=new Queue<String>().
S202, corresponding relationship between barrage textView control and the unique identifier of barrage is established.
What is stored in the management queue danmuShowQueue of above-mentioned building is the data of String type, in traditional scheme
Barrage information is a textView control, if going to cache true barrage textView control information in management queue
Words, since the memory overhead of textView control is larger, will lead to the memory overhead meeting of danmuShowQueue queue in this way
It is very big, but again in order to ensure the maintenance of barrage information, thus stored in the embodiment of the present invention be barrage unique mark
HashCode is accorded with, unique identifier hashCode is the data of a String type.Due to the unique identifier of barrage
The memory overhead of hashCode is very small, and this makes it possible to effectively establish barrage textView control and unique identifier
Corresponding relationship between hashCode.
S203, when barrage is prepared to enter into screen and executes mobile animation, obtain the textView that show of current screen and control
The unique identifier of the corresponding barrage of part;
Specifically when barrage, which is prepared to enter into screen, executes mobile animation, obtain in the textView object
HashCode gets the textView that current screen is shown particular by the textView.hashCode () method of calling
The corresponding barrage unique identifier tvHashCode of control.
S204, the corresponding barrage of textView control for showing current screen unique identifier storage to management queue
In.
The danmuShowQueue.add (tvHashCode) in danmuShowQueue queue is called to show current screen
The unique identifier of the corresponding barrage of textView control shown is stored into danmuShowQueu e queue.
S205, when textView control that current screen is shown removes screen, textView that current screen is shown
The unique identifier of the corresponding barrage of control removes management queue.
Specifically, when the textView control that current screen is shown removes screen, by calling danmuS
The unique identifier for the corresponding barrage of textView control that howQueue.poll () shows current screen is from d
It is removed away in anmuShowQueue queue.
In the embodiment of the present invention, according to sequencing toward danm when a plurality of barrage is shown on the screen
Data are added in uShowQueue queue and remove data, it is advanced since basic barrage information all travels at the uniform speed
The data come first can disappear from screen.By dynamically adding and deleting, the data in final d anmuShowQueue are forever
It is all far the barrage content shown in current screen.
S206, the barrage display setting for obtaining user instruct, and include height setting letter in barrage display area in described instruction
Breath.
The implementation process of this step specifically can refer to content described in step S108.
S207, all barrage textView control correspondences being currently displaying are taken out from management queue according to instruction
Target unique identifier, and corresponding target textView control is found by target unique identifier.
Specifically, taking out all textV iew controls being currently displaying from danmuShowQueue queue
Corresponding target unique identifier information finds corresponding target textView control by the unique identifier information of barrage.
S208, the target textView control currently height position information in the barrage container object is obtained.
Specifically, obtaining the target textView control currently height position information in the barrage container object
It include: that textView.getLayoutParams () in invocation target textView control gets target textView
The layout parameter information params of control;By calling the params.g etHeight () in params to obtain the target
Height position information of the textView control in the barrage container object.
S209, according to the barrage display area height setting information and the target textView control currently described
Height position information in barrage container object adjusts height of the target textView control in the barrage container object
Spend location information;
S210, believed according to height and position of the target textView control adjusted in the barrage container object
Barrage in breath display video.
Shown by barrage and be switched to for half screen shows by full frame, when detect user click the state of switching half screen when
Wait, that is, receive the barrage display setting instruction of user, it is necessary to from danmuShowQueue to it is interior it is middle take out it is all current
The hashCode information of the barrage textView shown finds corresponding textView control by hashCode, then
The textView.getLayoutParams () in textView control is called to get the layout ginseng of the textView control
Number information params, next we are got by calling params.getHeight () method in params
Elevation information where textView, and the elevation information is labeled as tvHeight.
Then the value information of tvHeight is become by original half by tvHeight=tvHeight/2.Pass through tune
The value information of new tvHeight is deposited with the params.height=tvHeight method in the params object of above-mentioned acquisition
It stores up in params, the textView.setLayoutParams (params) in the calling textView object will be new
Layout information is arranged into textView control, and the elevation information of the textView control just becomes original half in this way,
Therefore entire barrage has reformed into the target of half screen barrage.
Corresponding textView control is found by unique identifier in the embodiment of the present invention, realizes that barrage is switched fast life
Effect, can be effectively solved the slow problem of switch speed, and barrage height is arranged when the user clicks will currently show automatically later
The content shown all is switched within setting altitude range and is shown, barrage shows that switching efficiency is high.
It is to travel at the uniform speed that implied terms, which is barrage, when realization in embodiment illustrated in fig. 2, can be guaranteed in this way
The accuracy of data in danmuShowQueue queue.But what demand always changed, when barrage movement velocity right and wrong at the uniform velocity
When above scheme just can not normally perform.Therefore a kind of barrage display methods is also provided in the embodiment of the present invention, solved
In above scheme it is non-at the uniform velocity in the case of barrage data how to be safeguarded.
Referring to Fig. 3, for another embodiment schematic diagram of barrage display methods in the embodiment of the present invention, this method packet
It includes:
S301, a List set is defined.
Since danmuShowQueue is a queue in above scheme, the data structure of queue has a succession, right
In this present embodiment the implementation of Scheme algorithm with carry out be not very suitable to, therefore in the present embodiment design data set when
It waits not by the way of queue danmuShowQueue and is realized, but use set List and currently transported to store
Capable barrage information, i.e., the described List set is for storing the barrage information being currently running.
A List set is defined, specific definition method is List<String>listDanmu, wherein listDanmu
Next as List set needs to initialize listDanmu set, specific initial method is to pass through
ListDanmu=new List<String>() method of calling initializes set listDanmu.
One S302, building Map variable, and gather internal build barrage in the codeToTextView of Map variable
Mapping relations between TextView control and the unique identifier of barrage.
Wherein, the unique identifier of the barrage is the data of a String type.
Construct Map variable: private Map<TextView, String>codeToTextView;
In the unique identifier of Map variable codeToTextView set internal build one TextView control and barrage
Mapping relations between hashCode.
In addition, before gathering use to codeToTextView, it is necessary first to gather codeToTextView and carry out
Initialization operation is specifically by calling codeToTextView=new to the method for codeToTextView set initialization
HashMap<TextView, String>() are realized.
S303, when barrage is prepared to enter into screen and executes mobile animation, obtain the textView control that shows of current screen
The unique identifier of corresponding barrage, the unique identifier addition for the corresponding barrage of textView control that current screen is shown
Into List set.
When barrage be prepared to enter into screen execute mobile animation when, i.e., textView control need to show on the screen when
It waits, first by calling textView.hashCode () method corresponding to obtain the textView control that current screen is shown
The unique identifier hashCode value information tvHashCode of barrage.
The unique identifier of the corresponding barrage of textView control that current screen is shown is added to Li st set
In, comprising: it is corresponding by the text View control for calling listDanmu.add (tvHashCode) to show current screen
The unique identifier of barrage is added in List set.
S304, the mapping relations storage of the unique identifier of textView control and barrage that current screen is shown is arrived
In codeToTextView set.
Specifically, the mapping relations of the unique identifier of the textView control and barrage that current screen is shown are deposited
Store up codeToTextView set in, comprising: by call codeToTextView.put (t extView,
TvHashCode) method arrives the mapping relations storage of the unique identifier of textView control and barrage that current screen is shown
In codeToTextView set.
S305, when textView control that current screen is shown removes screen, gathered by codeToTextView
Mapping relations obtain the unique identifier of barrage corresponding to the textView control that shows of current screen, and by current screen
The unique identifier of barrage corresponding to the textView control of display is removed from List set.
Specifically, passing through codeTo TextView when the textView control shown when current screen removes screen
Mapping relations in set obtain the unique identifier of barrage corresponding to the textView control that current screen is shown, and will work as
The unique identifier of barrage corresponding to the textView control that forth screen is shown is removed from List set, comprising: when current
It is current by calling codeToTextView.get (textView) to obtain when the textView control that screen is shown removes screen
The unique identifier of barrage corresponding to the textView control that screen is shown;
Corresponding to the textView control for being shown current screen by calling listDanmu.remove (hashCode)
Barrage unique identifier from list set in remove.
It can be seen that whichever textView control removes by above-mentioned implementation, be all from set
ListDanmu removes the corresponding hashCode of the textView control, avoids to manage in above scheme in this way suitable in team
Sequence problem, thus the accuracy for the data being effectively guaranteed in listDanmu set, the speed pair of barrage speed
The accuracy of data in listDanmu set has no effect.
S306, the barrage display setting for obtaining user instruct, and include height setting letter in barrage display area in described instruction
Breath.
Specifically it is referred to content described in above-described embodiment.
S307, all barrage textView being currently displaying are taken out from List set according to described instruction
The corresponding target unique identifier of control, and corresponding target textView control is found by target unique identifier;
Specifically, described take out all barrages being currently displaying from List set according to described instruction
The corresponding target unique identifier of textView control, and corresponding target textView is found by target unique identifier and is controlled
Part, comprising: take out all corresponding target unique identifiers of text View control being currently displaying from list set
Information finds corresponding target textView control by the unique identifier information of barrage.
S308, the target textView control currently height position information in the barrage container object is obtained.
Specifically, described obtain the target textView control currently height and position in the barrage container object
Information, comprising: the textView.getLayoutParams () in invocation target textView control gets the target
The layout parameter information params of textView control;By calling the p arams.getHeight () in params to obtain institute
State height position information of the target textView control in the barrage container object.
S309, according to the barrage display area height setting information and the target textView control currently described
Height position information in barrage container object adjusts height of the target textView control in the barrage container object
Spend location information.
S310, believed according to height and position of the target textView control adjusted in the barrage container object
Barrage in breath display video.
Step S309 and S310 are specifically referred to content described in above example, and details are not described herein again.
The embodiment of the present invention uses set List to store the barrage information being currently running, to effectively guarantee
The accuracy of data in listDanmu set, the speed of barrage speed is to the accuracy of the data in set without any shadow
It rings.
Above-mentioned embodiment illustrated in fig. 2 and embodiment illustrated in fig. 3 are obviously improved on barrage switch speed, but are also deposited
In some problems, that is, switching is excessively lofty, and once the direct splashette of full frame barrage once becomes half screen barrage effect suddenly, this
Sample is somewhat unexpected to the feeling of people, it appears that shows screen flicker once, this hair very unfriendly to the user experience of user
One more friendly switching excessive manner is also provided in bright embodiment, in the case where guaranteeing switch speed, provides one kind more
Add natural excessive switching method, is another embodiment of barrage display methods in the embodiment of the present invention referring specifically to Fig. 4
Schematic diagram, this method comprises:
The management queue of one S401, building display barrage.
Wherein, which is used to safeguard the barrage information shown among current positive screen;The management queue of building is believed
Breath is Queue<String>danmuShowQueue, is next needed to the barrage queue being currently displaying
DanmuShowQueue is initialized, specific initial method be danmuShowQueue=new Queue <
String>()。
S402, corresponding relationship between barrage textView control and the unique identifier of barrage is established.
What is stored in the management queue danmuShowQueue of above-mentioned building is the data of String type, in traditional scheme
Barrage information is a textView control, if going to cache true barrage textView control information in management queue
Words, since the memory overhead of textView control is larger, will lead to the memory overhead meeting of danmuShowQueue queue in this way
It is very big, but again in order to ensure the maintenance of barrage information, thus stored in the embodiment of the present invention be barrage unique mark
HashCode is accorded with, unique identifier hashCode is the data of a String type.
Since the memory overhead of the unique identifier hashCode of barrage is very small, this makes it possible to effectively establish barrage
Corresponding relationship between textView control and unique identifier hashCode.
S403, when barrage is prepared to enter into screen and executes mobile animation, obtain the textView that show of current screen and control
The unique identifier of the corresponding barrage of part.
Specifically when barrage, which is prepared to enter into screen, executes mobile animation, obtain in the textView object
HashCode gets the textView that current screen is shown particular by the textView.hashCode () method of calling
The corresponding barrage unique identifier tvHashCode of control.
S404, the corresponding barrage of textView control for showing current screen unique identifier storage to management queue
In.
Specifically when barrage, which is prepared to enter into screen, executes mobile animation, obtain in the textView object
HashCode gets the textView that current screen is shown particular by the textView.hashCode () method of calling
The corresponding barrage unique identifier tvHashCode of control.
S405, when textView control that current screen is shown removes screen, textView that current screen is shown
The unique identifier of the corresponding barrage of control removes management queue.
Specifically, when the textView control that current screen is shown removes screen, by calling danmuS
The unique identifier for the corresponding barrage of textView control that howQueue.poll () shows current screen is from d
It is removed away in anmuShowQueue queue.
In the embodiment of the present invention, according to sequencing toward danm when a plurality of barrage is shown on the screen
Data are added in uShowQueue queue and remove data, it is advanced since basic barrage information all travels at the uniform speed
The data come first can disappear from screen.By dynamically adding and deleting, the data in final d anmuShowQueue are forever
It is all far the barrage content shown in current screen.
S406, the barrage display setting instruction for obtaining user;It is taken out from the management queue according to described instruction all
The corresponding target unique identifier of barrage textView control being currently displaying, and found by target unique identifier
Corresponding target textView control;
Specifically, being referred to the description content in step S206 and S207, details are not described herein again.
S407, the setting target textView control are in screen level moving distance Sx.
Smoothly switch into half screen barrage to realize, design when it is contemplated that move horizontally Sx apart from when it is complete
At entire handoff procedure.Wherein Sx is the width that the threshold value threshold value is centainly less than screen, by adjusting the distance of Sx
Size can indirectly adjust excessive smoothness.
S408, the horizontal movement velocity of barrage is labeled as Vx, the time dT of barrage smooth change is calculated by Sx/Vx.
Specifically, the movement speed of barrage is usually determination, the horizontal movement velocity of barrage is labeled as Vx, therefore just
The time dT of smooth change can be calculated by way of Sx/Vx.
S409, according to the barrage display area height setting information, calculate the vertical range moved within the dT time and
Vertical speed Vy.
By barrage by it is full frame be switched to half screen for, needing the distance that converts for vertical direction is tvHeight-
TvHeight/2=tvHeight/2, that is to say, that needing the vertical range completed within the time of dT is tvHeight/2,
Therefore it is tvHeight/2dT that vertical movement velocity, which can be calculated, which is labeled as Vy by us.
According to the relationship of the speed of physics, by resolution of velocity at such 2 directions Vx and Vy, then entire textView is controlled
The true directions of part movement will be oblique line directions.The motion profile of i.e. final textView control will be an at the uniform velocity oblique line
Movement, the problem of being thus not in 1/2 splashette for being directly switch to height.
S410, the preset horizontal animation of target textView control is obtained, is the target textView according to dT and Vy
Control constructs a vertical animation;A combined animation is defined, and the horizontal animation and the vertical animation are added to group
In the object for closing animation.
In the present embodiment, the preset horizontal animation of target textView control is obtained, the mode specifically obtained is to pass through tune
It can be obtained by current horizontal animation animX with the textView.getAnimation () in textView control.
Due to obtained Vy and and dT, can to textView control add a longitudinal movement animation, specifically
Animation building process be define an ObjectAnimator type mAnimatorTranslateY object.Specifically, root
It is that the target textView control one vertical animation of building includes: according to dT and Vy
Define the mAnimatorTranslateY object of an ObjectAnimator type;
Call ObjectAnimator.ofFloat (textView, " translationY ", tvHeight, tvHeigh
T ') construct the vertical animation that movement velocity is Vy, wherein and the ObjectAnimator.ofFloat function is to target
TextView control executes vertical animation, and the starting point of the vertical animation is tvHeight, and target end point is tvHeight ',
Return value is mAnimatorTranslateY object information;
Call the mAnimatorTranslateY.setDuration (dT) in mAnimatorTranslateY object will
The execution period dT of vertical animation is arranged into object mAnimatorTranslateY.
In the embodiment of the present invention, need to define a combined animation AnimationSet animSet, and pass through calling
Constructed fuction in AnimationSet initializes animSet, particular by calling animSet=new
AnimationSet () is initialized.Then it calls animSet.add (animX) and calls animSet.add
(mAnimatorTranslateY), thus horizontal animation and vertical animation have all been added in animSet object.
S411, the execution that horizontal animation and vertical animation are opened by calling combined animation, realize be based on institute in video
The barrage for stating target textView control is shown.
Since horizontal animation and vertical animation to be all added in animSet object, eventually by animSet pairs of calling
AnimSet.startAnim () method as in opens the execution of horizontal and vertical animation, realizes be based on the mesh in video
The barrage of mark textView control is shown.
The embodiment of the present invention adjusts the smoothness entirely switched by adjusting the size of Sx, and then realizes and smoothly cut
The target changed, switching in this way can make barrage switching more smooth, and barrage shows more reasonable.
Sx defined above is a fixed value information, until barrage information is moved to the close end of screen when
It waits, just will appear a problem at this time is exactly Distance Remaining ratio Sx small, at this time if held according to above-mentioned implementation
Row will lead to the barrage and can not be moved in setting range just have moved out screen, and such effect is exactly to the feeling of people
There is exception in control logic, a solution is provided for this problem in the embodiment of the present invention, so that this special screne
Barrage can still be moved in range and remove again when lower.Specifically, referring to Fig. 5, for barrage in the embodiment of the present invention
Another embodiment schematic diagram of display methods, this method comprises:
The management queue of one S501, building display barrage.
S502, corresponding relationship between barrage textView control and the unique identifier of barrage is established.
Wherein, the unique identifier of the barrage is the data of a String type.
S503, when barrage is prepared to enter into screen and executes mobile animation, obtain the textView that show of current screen and control
The unique identifier of the corresponding barrage of part.
S504, the corresponding barrage of textView control for showing current screen unique identifier storage to management queue
In.
S505, when textView control that current screen is shown removes screen, textView that current screen is shown
The unique identifier of the corresponding barrage of control removes management queue.
S506, the barrage display setting instruction for obtaining user, take out from the management queue all according to described instruction
The corresponding target unique identifier of barrage textView control being currently displaying, and found by target unique identifier
Corresponding target textView control.
S507, setting target textView control are in screen level moving distance Sx.
Step S501~S507 is specifically referred in embodiment illustrated in fig. 4 in step S401~S407 in the present embodiment
Specific implementation process, details are not described herein again.
S508, calculating target textView control are fully removed the distance reallyDistance moved required for screen.
When the user clicks when barrage switching push button, the location information that textView control is currently located is obtained first,
Specific acquisition methods are by calling the textView.getLayoutParams () in textView control to work as to get
Next the layout parameter information layoutParams of preceding textView control is called in layoutParams
What layoutParams.getWidth was got is the coordinate information of the X-axis where current textView control, herein by the value
Labeled as textViewX.
TextView control itself is that have itself a width information, and the above-mentioned location information got is usually all
Location information where the upper left corner of textView control, therefore the citing that view removes completely away is to need to add
The length information of textView control itself, obtain the length information of textView control is by calling textView control
TextView.getWidth () in part gets the length information of textView itself, herein marks the length information
For textViewWidth.
Therefore it is textViewX+ that current textView control, which is fully removed the distance moved required for screen,
TextViewWidth, herein by this it is specific label be.
S509, compare size between Sx and reallyDistance, if the value of the value ratio reallyDistance of Sx is big,
The horizontal movement velocity of barrage is labeled as Vx, the time dT of barrage smooth change is calculated by reallyDistance/Vx.
Specifically, it is necessary to compare the size information of reallyDistance and Sx, if the value ratio of Sx
The value of reallyDistance is big, we are just subject to the value of Sx at this time, concrete implementation mode as shown in the embodiments of figure 4 in
It is described.The value of the even value of Sx ratio reallyDistance is small, and the time dT ' of barrage smooth change is calculated by Sx/Vx;According to
The barrage display area height setting information calculates the vertical range moved within the dT ' time and vertical speed Vy ';It obtains
The preset horizontal animation of target textView control;According to dT ' and Vy ' it is that the target textView control constructs one
Second vertical animation;Combined animation is defined, and the horizontal animation and the second vertical animation are added to the object of combined animation
In;By calling combined animation to open the execution of horizontal animation and the second vertical animation, realizes be based on the target in video
The barrage of textView control is shown.Specific implementation process can refer to embodiment illustrated in fig. 4.
If the value of the value ratio reallyDistance of Sx is big, just illustrate that Distance Remaining is not enough to for view being moved at this time
Inside screen, it is therefore desirable to specially treated be done to this kind of situation, i.e., the horizontal movement velocity of barrage is labeled as Vx, passed through
The time dT of reallyDistance/Vx calculating barrage smooth change.
S510, according to barrage display area height setting information, calculate the vertical range moved within the dT ' time and vertical
Speed Vy.
In the present embodiment, equally by taking half screen as an example, getting vertical travel distance tvHeight/2, (specific acquisition methods are such as
Described in above-mentioned Fig. 4 embodiment consistent), if vertical speed is tvHeight/2dT, which is labeled as to go out for Vy
Reaching within half screen when now just removal away, starting has just lost the meaning into half screen in this case,
In order to guarantee that view textView control reaches in half screen before no removal, it is therefore desirable to do a special place to Vy
Reason, needs for the speed of Vy to be increased to original 1.5 times, that is, 1.5Vy, this makes it possible to the speed for guaranteeing longitudinal is faster
Movement, thus can there are no ensure that view can reach inside half screen when moving away in view.
In addition to above-mentioned increase y-axis speed one, the mode by the reduction of the speed of Vx can also be taken to reach said effect,
Such as the speed of Vx can be reduced to original half, that is, 1/2Vx, the effect reached in this way is also consistent, even
It is that can be overlapped above-mentioned two effect to reach a kind of more friendly excessive experience.
S511, the preset horizontal animation of target textView control is obtained;It is target textView control according to dT and 1.5Vy
Part constructs a first vertical animation;Combined animation is defined, and horizontal animation and the first vertical animation are added to combined animation
Object in.
In the present embodiment, the preset horizontal animation of target textView control is obtained, the mode specifically obtained is to pass through tune
It can be obtained by current horizontal animation animX with the textView.getAnimation () in textView control.
It is described that a first vertical animation is constructed for the target textView control according to dT and 1.5Vy, comprising:
Define the mAnimatorTranslateY object of an ObjectAnimator type;
Call ObjectAnimator.ofFloat (textView, " translationY ", tvHeight, tvHeigh
T ') construct the first vertical animation that movement velocity is 1.5Vy, wherein and the ObjectAnimator.ofFloat function is to mesh
It marks textView control and executes the first vertical animation, the starting point of the first vertical animation is t vHeight, and target end point is
TvHeight ', return value is mAnimatorTranslateY object information;
Call the mAnimatorTranslateY.setDuration (dT) in mAnimatorTranslateY object will
The execution period dT of first vertical animation is arranged into object mAnimatorTranslateY.
In the embodiment of the present invention, need to define a combined animation AnimationSet animSet, and pass through calling
Constructed fuction in AnimationSet initializes animSet, particular by calling animSet=new
AnimationSet () is initialized.Then it calls animSet.add (animX) and calls animSet.add
(mAnimatorTranslateY), thus horizontal animation and the first vertical animation have all been added in animSet object.
S512, the execution that horizontal animation and the first vertical animation are opened by calling combined animation, realize base in video
It is shown in the barrage of the target textView control.
Since horizontal animation and the first vertical animation to be all added in animSet object, eventually by calling
AnimSet.startAnim () method in animSet object opens horizontal and the first vertical animation execution, in video
Realize that the barrage based on the target textView control is shown.
The moving distance of screen is removed completely in the embodiment of the present invention by comparing textView control
The size of reallyDistance and Sx, when reallyDistance is less than Sx, adjustment vertically moves speed to 1.5Vy, nose
Hair barrage can not be moved in setting range the case where just having moved out screen, in the same of the personal settings for supporting barrage to show
When that barrage is shown is more reasonable.
The embodiment of barrage display device in the embodiment of the present invention is described below.
Referring to Fig. 6, for one embodiment schematic diagram of barrage display device in the embodiment of the present invention, which includes:
Construction unit 601, for constructing view control;
Fills unit 602, in the relevant style information of view control filling barrage;
Initialization unit 603 is initialized for the location information to the view control;
First acquisition unit 604, for obtaining layout parameter object;
Setting unit 605, for barrage placement position information to be arranged according to the layout parameter object;
Adding unit 606, for the barrage placement position information to be added in the view control, and by the view
Figure control is added in preset barrage container object;
Second acquisition unit 607, the barrage for obtaining user show setting instruction, include that barrage is shown in described instruction
Region height setting information;
Display unit 608, for adjusting height of the view control in the barrage container object according to described instruction
Location information is spent, barrage in video is shown according to the height position information.
Optionally, the construction unit 601 is specifically used for:
TextView is called to construct an empty textView control;
The fills unit 602 is specifically used for:
By calling the textView.setTextColor in textView object that the text information of barrage information is arranged
At pre-set color;
By calling textView.setSize to set font for default size;
By calling textView.setText, specific barrage content information is set.
Optionally, the first acquisition unit 604 is specifically used for:
By calling ViewGroup.layoutParams params=new ViewGroup.layoutParams () side
Method obtains the layout parameter object params of a ViewGroup;
The setting unit 605 is specifically used for:
Call the params.width=ViewGroup.layoutParams.WRAP_C ONTENT in params object
Width information is arranged to contents of parcel size;
Pass through the params.height=ViewGroup.layoutParams.WRAP_CO NTENT in params object
Elevation information is arranged to contents of parcel, the elevation information of dynamic adaptation text.
Optionally, the adding unit 606 is specifically used for:
Pass through the barrage placement position information for calling textView.setLayoutParams (params) will to set
Params is applied on textView control;
(textView controls textView to danmuContainer.addView in calling danmuContainer object
Part is added in barrage container object danmuContainer.
Optionally, the display unit 608 is specifically used for:
Held by calling the danmuContainer.getHeight () in danmuContainer container to get barrage
The entire elevation information danmuHeight of device;
By calling Random random=new Random () to construct a random number generator rando m;
Danmu Height is arrived by calling the random.netFloat (danmuHeight) in random object to obtain 0
Between elevation information randomHeigh;
According to the barrage display area height setting information, by calling params.marginTop=rando
TextView control location information away from top in father's layout is arranged in mHeight method, realizes the height and position of adjustment barrage
Information shows barrage in video according to the height position information.
Referring to Fig. 7, for another embodiment schematic diagram of barrage display device in the embodiment of the present invention, the device packet
It includes:
Construction unit 701, for constructing the management queue of a display barrage, the management queue is for safeguarding currently just
The barrage information shown among screen;
Unit 702 is established, the corresponding relationship for establishing between barrage textView control and the unique identifier of barrage,
The unique identifier of the barrage is the data of a String type;
First acquisition unit 703, for it is aobvious to obtain current screen when barrage is prepared to enter into screen and executes mobile animation
The unique identifier of the corresponding barrage of textView control shown;
Queue management unit 704, unique mark of the corresponding barrage of textView control for showing current screen
Symbol storage is into the management queue;When the textView control that current screen is shown removes screen, current screen is shown
The unique identifier of the corresponding barrage of textView control remove the management queue;
Second acquisition unit 705, the barrage for obtaining user show setting instruction, include that barrage is shown in described instruction
Region height setting information;
Third acquiring unit 706 all is currently being shown for being taken out from the management queue according to described instruction
The corresponding target unique identifier of barrage textView control shown, and corresponding target is found by target unique identifier
TextView control;Obtain the target textView control currently height position information in the barrage container object;
Adjustment unit 707, for being controlled according to the barrage display area height setting information and the target textView
The current height position information in the barrage container object of part, adjusts the target textView control and holds in the barrage
Height position information in device object;
Display unit 708 is used for according to the target textView control adjusted in the barrage container object
Height position information show video in barrage.
Optionally, the first acquisition unit 703 is specifically used for: being worked as by calling textView.hashCode () to obtain
The unique identifier tvHashCode for the corresponding barrage of textView control that forth screen is shown.
Optionally, the management queue is danmuShowQueue queue, and the queue management unit 704 is specifically used for:
The danmuShowQueue.add (tvHashCode) in danmuShowQueue queue is called to show current screen
The unique identifier of the corresponding barrage of textView control shown is stored into danmuShowQueue queue;
When the textView control that current screen is shown removes screen, by calling danmuShowQueue.poll ()
The unique identifier for the corresponding barrage of textView control that current screen is shown is removed from danmuShowQueue queue
It goes out.
Optionally, the third acquiring unit 706 is specifically used for:
All corresponding targets of textView control being currently displaying are taken out from danmuShowQueue queue
Unique identifier information finds corresponding target textV iew control by the unique identifier information of barrage;
It is described to obtain the target textView control currently height position information in the barrage container object, packet
It includes:
TextView.getLayoutParams () in invocation target textView control gets target text
The layout parameter information params of View control;
By calling the params.getHeight () in params to obtain the target textView control in the bullet
Height position information in curtain container object.
Referring to Fig. 8, for another embodiment schematic diagram of barrage display device in the embodiment of the present invention, the device packet
It includes:
Definition unit 801, for defining a List set, the List set is for storing the bullet being currently running
Curtain information;
Construction unit 802 gathers internal structure for constructing a Map variable, and in the codeToTextView of Map variable
The mapping relations between barrage TextView control and the unique identifier of barrage are built, the unique identifier of the barrage is one
The data of String type;
Adding unit 803, for obtaining what current screen was shown when barrage is prepared to enter into screen and executes mobile animation
The unique identifier of the corresponding barrage of textView control, the corresponding barrage of textView control that current screen is shown is only
One identifier is added in List set;
Storage unit 804, the mapping of the unique identifier of textView control and barrage for showing current screen
Relationship storage is into codeToTextView set;
Unit 805 is removed, when the textView control for showing when current screen removes screen, is passed through
Mapping relations in codeToTextView set obtain barrage corresponding to the textView control that current screen is shown only
One identifier, and the unique identifier of barrage corresponding to textView control that current screen is shown is moved from List set
It removes;
Acquiring unit 806, the barrage for obtaining user show setting instruction, include barrage display area in described instruction
Height setting information;All barrage textView being currently displaying are taken out from List set according to described instruction
The corresponding target unique identifier of control, and corresponding target textView control is found by target unique identifier;It obtains
The current height position information in the barrage container object of the target textView control;
Adjustment unit 807, for being controlled according to the barrage display area height setting information and the target textView
The current height position information in the barrage container object of part, adjusts the target textView control and holds in the barrage
Height position information in device object;
Display unit 808 is used for according to the target textView control adjusted in the barrage container object
Height position information show video in barrage.
Optionally, the adding unit 803 is specifically used for:
The corresponding barrage of textView control that current screen is shown is obtained by calling textView.hashCode ()
Unique identifier.
Optionally, the adding unit 803 is specifically also used to:
Pass through the corresponding bullet of textView control for calling listDanmu.add (tvHashCode) to show current screen
The unique identifier of curtain is added in List set;
The storage unit 804 is specifically used for: by calling codeToTextView.put (textView, tvHa
ShCode) method arrives the mapping relations storage of the unique identifier of textView control and barrage that current screen is shown
In codeToTextView set.
Optionally, the unit 805 that removes is specifically used for: when the textView control that current screen is shown removes screen
When, by calling codeToTextView.get (textView) to obtain corresponding to the text View control that current screen is shown
Barrage unique identifier;
Corresponding to the textView control for being shown current screen by calling listDanmu.remove (hashCode)
Barrage unique identifier from list set in remove.
A kind of electronic equipment is also provided in the embodiment of the present invention, refers to Fig. 9, the electronic equipment includes:
Memory 901, processor 902 and is stored in the computer that can be run on the memory and on the processor
Program 903, wherein above-mentioned barrage display methods may be implemented in the processor 902 when executing the computer program 903.
It should be noted that this application involves electronic equipment include but is not limited to be: mobile terminal (mobile phone, intelligent hand
Machine, PAD, laptop etc.), fixed terminal (computer).
For ease of description, only parts related to embodiments of the present invention are shown, disclosed by specific technical details, asks
Referring to present invention method part.Memory 901 can be used for storing computer program 903, and above-mentioned computer program includes
Software program, module and data, processor 902 execute the computer program 903 for being stored in memory 901 by running, thus
Execute the various function application and data processing of electronic equipment.
The embodiment of the present invention also provides a kind of computer readable storage medium, wherein the computer readable storage medium can
It is stored with program, which includes some or all of barrage display methods recorded in above method embodiment step when executing
Suddenly.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,
The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
The above, the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although referring to before
Stating embodiment, invention is explained in detail, those skilled in the art should understand that: it still can be to preceding
Technical solution documented by each embodiment is stated to modify or equivalent replacement of some of the technical features;And these
It modifies or replaces, the spirit and scope for technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution.
Claims (10)
1. a kind of barrage display methods, which is characterized in that the described method includes:
Construct view control;
In the relevant style information of view control filling barrage;
The location information of the view control is initialized;
Obtain layout parameter object;
According to the layout parameter object, barrage placement position information is set;
The barrage placement position information is added in the view control;
The view control is added in preset barrage container object;
The barrage display setting instruction of user is obtained, includes barrage display area height setting information in described instruction;
Height position information of the view control in the barrage container object is adjusted according to described instruction, according to the height
It spends location information and shows barrage in video.
2. the method according to claim 1, wherein the building view control includes: to call TextView structure
Build an empty textView control;
It is described to fill the relevant style information of barrage in the view control, comprising:
It is pre- by calling the textView.setTextColor in textView control to be arranged to the text information of barrage information
If color;
By calling textView.setSize to set font for default size;
By calling textView.setText, specific barrage content information is set.
3. according to the method described in claim 2, it is characterized in that, the acquisition layout parameter object includes:
By call ViewGroup.layoutParams params=new ViewGroup.layoutParams () method come
Obtain the layout parameter object params of a ViewGroup;
It is described that barrage placement position information is arranged according to the layout parameter object, comprising:
Call the params.width=ViewGroup.layoutParams.WRAP_C ONTENT in params object will be wide
Degree information is arranged to contents of parcel size;
It will be high by the params.height=ViewGroup.layoutParams.WRAP_CO NTENT in params object
Degree information is arranged to contents of parcel, the elevation information of dynamic adaptation text.
4. according to the method described in claim 3, it is characterized in that, it is described the barrage placement position information is added to it is described
In view control, comprising:
Pass through the barrage placement position information params for calling textView.setLayoutParams (params) will to set
It is applied on textView control.
5. according to the method described in claim 4, it is characterized in that, described be added to preset barrage appearance for the view control
In device object, comprising:
(textView is by textV iew control by the danmuContainer.addView for calling in danmuContainer object
It is added in barrage container object danmuContainer.
6. according to the method described in claim 5, it is characterized in that, described adjust the view control in institute according to described instruction
The height position information in barrage container object is stated, barrage in video is shown according to the height position information, comprising:
By calling the danmuContainer.getHeight () in danmuContainer container to get barrage container
Entire elevation information danmuHeight;
By calling Random random=new Random () to construct a random number generator rando m;
By calling the random.netFloat (danmuHeight) in random object to obtain between 0 to danmu Height
Elevation information randomHeigh;
According to the barrage display area height setting information, by calling params.marginTop=rando mHeight
TextView control location information away from top in father's layout is arranged in method, realizes the height position information of adjustment barrage, root
Barrage in video is shown according to the height position information.
7. a kind of barrage display device, which is characterized in that described device includes:
Construction unit, for constructing view control;
Fills unit, in the relevant style information of view control filling barrage;
Initialization unit is initialized for the location information to the view control;
First acquisition unit, for obtaining layout parameter object;
Setting unit, for barrage placement position information to be arranged according to the layout parameter object;
Adding unit, for the barrage placement position information to be added in the view control, and by the view control
It is added in preset barrage container object;
Second acquisition unit, the barrage for obtaining user show setting instruction, include that barrage display area is high in described instruction
Spend setting information;
Display unit is believed for adjusting height and position of the view control in the barrage container object according to described instruction
Breath shows barrage in video according to the height position information.
8. device according to claim 7, which is characterized in that the construction unit is specifically used for:
TextView is called to construct an empty textView control;
The fills unit is specifically used for:
It is pre- by calling the textView.setTextColor in textView object to be arranged to the text information of barrage information
If color;
By calling textView.setSize to set font for default size;
By calling textView.setText, specific barrage content information is set.
9. device according to claim 8, which is characterized in that the first acquisition unit is specifically used for:
By call ViewGroup.layoutParams params=new ViewGroup.layoutParams () method come
Obtain the layout parameter object params of a ViewGroup;
The setting unit is specifically used for:
Call the params.width=ViewGroup.layoutParams.WRAP_C ONTENT in params object will be wide
Degree information is arranged to contents of parcel size;
It will be high by the params.height=ViewGroup.layoutParams.WRAP_CO NTENT in params object
Degree information is arranged to contents of parcel, the elevation information of dynamic adaptation text.
10. a kind of electronic equipment characterized by comprising memory and is stored on the memory and can be in institute processor
State the computer program run on processor, wherein the processor may be implemented right when executing the computer program and want
Seek 1 to 6 any method.
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 true CN109117237A (en) | 2019-01-01 |
CN109117237B 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) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110012306A (en) * | 2019-04-02 | 2019-07-12 | 广州虎牙信息科技有限公司 | Display methods, device, equipment and the storage medium of barrage |
CN111246270A (en) * | 2020-01-14 | 2020-06-05 | 广州虎牙科技有限公司 | Method, device, equipment and storage medium for displaying bullet screen |
CN112581561A (en) * | 2020-12-25 | 2021-03-30 | 深圳市元征科技股份有限公司 | Method and device for creating pin view, electronic equipment and storage medium |
CN115988169A (en) * | 2023-03-20 | 2023-04-18 | 全时云商务服务股份有限公司 | Method and device for rapidly displaying real-time video screen-combination characters in cloud conference |
Citations (4)
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 |
-
2018
- 2018-09-05 CN CN201811029856.6A patent/CN109117237B/en active Active
Patent Citations (4)
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)
Title |
---|
JAMY CAI: "Android自定义View修炼一自定义弹幕效果View", 《HTTPS://WWW.CNBLOGS.COM/JCZMDEVELOPER/P/4872460.HTML》 * |
坚持、梦想: "android中的弹幕效果", 《HTTPS://BLOG.CSDN.NET/U014538437/ARTICLE/DETAILS/49306555》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110012306A (en) * | 2019-04-02 | 2019-07-12 | 广州虎牙信息科技有限公司 | Display methods, device, equipment and the storage medium of barrage |
CN111246270A (en) * | 2020-01-14 | 2020-06-05 | 广州虎牙科技有限公司 | Method, device, equipment and storage medium for displaying bullet screen |
CN111246270B (en) * | 2020-01-14 | 2022-02-25 | 广州虎牙科技有限公司 | Method, device, equipment and storage medium for displaying bullet screen |
CN112581561A (en) * | 2020-12-25 | 2021-03-30 | 深圳市元征科技股份有限公司 | Method and device for creating pin view, electronic equipment and storage medium |
CN115988169A (en) * | 2023-03-20 | 2023-04-18 | 全时云商务服务股份有限公司 | Method and device for rapidly displaying real-time video screen-combination characters in cloud conference |
CN115988169B (en) * | 2023-03-20 | 2023-08-18 | 全时云商务服务股份有限公司 | Method and device for rapidly displaying real-time video on-screen text in cloud conference |
Also Published As
Publication number | Publication date |
---|---|
CN109117237B (en) | 2021-10-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109117237A (en) | A kind of barrage display methods, device and electronic equipment | |
JP5750103B2 (en) | Animation control apparatus, animation control method, and animation control program | |
CN101895634A (en) | Method and device for realizing dynamic switching of mobile terminal interface | |
CN108337547B (en) | Character animation realization method, device, terminal and storage medium | |
CN105979337B (en) | A kind of barrage playing device and method | |
US9924240B2 (en) | Systems and methods for interactive video generation and rendering | |
JP2023517917A (en) | VIRTUAL SCENE DISPLAY METHOD, APPARATUS, DEVICE, AND COMPUTER PROGRAM | |
CN105938409A (en) | Display method of scenario emoticon using instant message service and user device therefor | |
CN103793134A (en) | Touch screen terminal and multi-interface switching method thereof | |
CN102945116A (en) | Interface switching display method and device, and mobile terminal | |
CN110347317A (en) | A kind of windows switching method, device, storage medium and interactive intelligent tablet computer | |
CN107943372A (en) | A kind of interface display method, device and computer-readable recording medium | |
CN106325649A (en) | 3d dynamic display method and mobile terminal | |
CN108905203B (en) | Information processing method, information processing apparatus, storage medium, and electronic apparatus | |
CN114443269B (en) | Frame rate adjusting method and related device | |
CN107180445B (en) | Expression control method and device of animation model | |
CN109271085A (en) | Image display method, device and electronic equipment | |
CN107077347A (en) | View management framework | |
CN109656463B (en) | Method, device and system for generating individual expressions | |
CN106325505A (en) | Control method and device based on viewpoint tracking | |
CN106909263A (en) | The interactive display method and system of 3-D view | |
CN106843467B (en) | Screen expansion system based on position and expansion method thereof | |
CN102790733A (en) | Method, client end and system for differentiated display of instant communication interaction interface | |
CN105988762B (en) | Display methods, hidden method and the device of animation frame | |
CN109361961A (en) | A kind of barrage display methods, device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |