CN111813296B - View component display method and device and terminal - Google Patents
View component display method and device and terminal Download PDFInfo
- Publication number
- CN111813296B CN111813296B CN201910284482.0A CN201910284482A CN111813296B CN 111813296 B CN111813296 B CN 111813296B CN 201910284482 A CN201910284482 A CN 201910284482A CN 111813296 B CN111813296 B CN 111813296B
- Authority
- CN
- China
- Prior art keywords
- sliding
- view
- list
- view component
- view data
- 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
Links
Images
Classifications
-
- 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/0484—Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
- G06F3/04847—Interaction techniques to control parameter settings, e.g. interaction with sliders or dials
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The invention discloses a method, a device and a terminal for displaying a view component, wherein the method for displaying the view component comprises the following steps: acquiring a sliding event monitored by a sliding view component; determining a sliding direction of the sliding event; when the sliding direction is a first direction, obtaining view data at a first array position in a first array list, wherein the first array list is used for storing view data corresponding to the view deleted in a sliding manner; adding the view data of the first list position to a second list position in a second array list corresponding to the sliding view component; rendering and displaying the sliding view component according to the view data of the second list position. The invention realizes the rollback and redisplay of the view which is deleted by sliding operation, avoids the singleness of the function realization of the application program which displays the view based on the sliding operation, and ensures that the interaction between a user and the display interface of the application program is more convenient.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a method, a device and a terminal for displaying a view component.
Background
With the rapid development of network technology, the functions that can be realized by the application programs are more and more, for example, in some application programs, the user can delete the display view in the application program by sliding left and right on the terminal screen. Specifically, when the user's finger slides the view to the left on the terminal screen to reach the sliding threshold, the view will fly out of the display interface to the left; when the user finger slides the view to the right on the terminal screen to reach the sliding threshold value, the view flies out of the display interface to the right.
In the related art, the application program can only realize the function of sliding left and right to delete the view, so that the function of the application program which performs view display based on sliding operation is single, and the inconvenience of interaction between a user and a display interface of the application program is increased.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for displaying a view component, and a terminal. The technical scheme is as follows:
in one aspect, a method for displaying a view component is provided, the method comprising:
acquiring a sliding event monitored by a sliding view component;
determining a sliding direction of the sliding event;
when the sliding direction is a first direction, acquiring view data of a first array position in a first array list; the first array list is used for storing view data corresponding to the view deleted in a sliding mode;
adding the view data of the first list position to a second list position in a second array list corresponding to the sliding view component;
rendering and displaying the sliding view component according to the view data of the second list position.
In another aspect, there is provided a view component display apparatus, the apparatus including:
the first acquisition module is used for acquiring a sliding event monitored by the sliding view component;
a determination module for determining a sliding direction of the sliding event;
the second obtaining module is used for obtaining view data of a first array position in the first array list when the sliding direction is the first direction; the first array list is used for storing view data corresponding to the view deleted in a sliding mode;
an adding module, configured to add the view data at the first list position to a second list position in a second array list corresponding to the sliding view component;
and the first rendering and displaying module is used for rendering and displaying the sliding view component according to the view data of the second list position.
In another aspect, a terminal is provided, which includes a processor and a memory, where at least one instruction, at least one program, a set of codes, or a set of instructions is stored in the memory, and the at least one instruction, the at least one program, the set of codes, or the set of instructions is loaded and executed by the processor to implement the above-mentioned view component display method.
When the sliding direction of a sliding event monitored by a sliding view component is determined to be a first direction, obtaining view data at a first array position in a first array list, wherein the first array list is used for storing view data corresponding to a sliding deleted view; and then adding the view data of the preset first list position to a second list position in a second array list corresponding to the sliding view component, and rendering and displaying the sliding view component according to the view data of the second list position, so that the view which is deleted in a sliding mode is returned to be displayed again through sliding operation, the singleness of the realization of the function of the application program which is displayed in the view based on the sliding operation is avoided, and the interaction between a user and the display interface of the application program is more convenient.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flow chart of a method for displaying a view component according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating another method for displaying a view component according to an embodiment of the present invention;
FIG. 3 is a flow chart illustrating another method for displaying a view component according to an embodiment of the present invention;
FIG. 4 is a flow chart illustrating another method for displaying a view component according to an embodiment of the present invention;
FIG. 5(a) is an interface display of a sliding view assembly prior to sliding rollback provided by an embodiment of the present invention;
FIG. 5(b) is an interface display of a sliding view component during sliding rollback provided by an embodiment of the present invention;
FIG. 5(c) is an interface illustration of the slide view component upon completion of the sliding rollback provided by embodiments of the present invention;
FIG. 6 is a schematic structural diagram of a viewing assembly display apparatus according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of another viewing assembly display apparatus according to an embodiment of the present invention;
FIG. 8 is a schematic structural diagram of another viewing assembly display apparatus according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Referring to fig. 1, which is a schematic flow chart illustrating a method for displaying a view component according to an embodiment of the present invention, it should be noted that the method for displaying a view component according to an embodiment of the present invention is applicable to a view component display apparatus according to an embodiment of the present invention, where the view component display apparatus may be configured in an application program of a terminal, and the terminal may be a hardware device with various operating systems, such as a mobile phone, a tablet computer, a palm computer, and a personal digital assistant.
Further, the present specification provides method steps as described in the examples or flowcharts, but may include more or fewer steps based on routine or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In actual system or end product execution, sequential execution or parallel execution (e.g., parallel processor or multi-threaded environment) may be possible according to the embodiments or methods shown in the figures. Specifically, as shown in fig. 1, the method includes:
s101, acquiring a sliding event monitored by the sliding view component.
In the present specification embodiment, the sliding view components may include, but are not limited to, RecycleView and ViewPager.
The RecycleView is a component provided by an Android (Android) system and used for large-volume data presentation and view reusability. The flexible (expandability) is the characteristic of the RecyclerView, and the RecyclerView can realize the functions of transversely rolling ListView, transversely rolling GridView, waterfall flow control and the like. The RecyclerView mainly comprises four parts: layout manager, Adapter, Item recording, and ItemAnaimator. The Layout Manager is responsible for the Layout of the RecyclerView, including the acquisition and recovery of the Item View. RecyclerView provides three layout managers, LinerLayoutManager, GridLayoutManager, and StaggerdedGridLayoutManager. LinerLayoutManager is used to show items in vertical or horizontal lists. GridLayoutManager is used to display items in a grid fashion. StaggerdedGridLayoutManager is used to show items in a waterfall flow fashion. The Adapter is used to provide data for the RecycleView. Item Decode (space style) is used to add a partition line between items. Item animation is used to add, delete, move, change Item animation, and the RecyclerView provides the default Item animation implementation class as DefaultItemAnaimator.
The ViewPager is a view sliding switching component provided by an Android system, and can enable a user to switch a current view left and right.
Specifically, the embodiments of the present specification lay out the stacked view by creating a swipecardlayout manager (sliding view layout manager) that inherits the layout manager, incorporating the recycleview in the onlayoutcoldren () callback. onLayoutChildren () is the main entry for LayoutManager and is called when a view needs to initialize a layout, and is called again when the adapter's data changes.
In practical applications, the monitoring function of the sliding view component may be configured in advance, and the sliding view component monitors the sliding event in the dispatchTouchEvent () callback.
S103, determining the sliding direction of the sliding event.
In this embodiment, when a sliding event is monitored, a first coordinate (x1, y1) on the screen corresponding to the start of the sliding event and a second coordinate (x2, y2) on the screen corresponding to a certain time during the sliding event or the end of the sliding event may be obtained, and then the sliding direction of the sliding event may be determined according to the first coordinate (x1, y1) and the second coordinate (x2, y 2).
Specifically, when the sliding view component is supporting lateral sliding, it may be set that when the difference between x1 of the first coordinate and x2 of the second coordinate is less than 0, the sliding direction of the sliding event is rightward sliding; when the difference between x1 of the first coordinate and x2 of the second coordinate is greater than 0, the sliding direction representing the sliding event is a leftward sliding.
When the sliding view component is to support vertical sliding, it can be set that when the difference between y1 of the first coordinate and y2 of the second coordinate is less than 0, the sliding direction of the sliding event is indicated as upward sliding; when the difference between y1 of the first coordinate and y2 of the second coordinate is greater than 0, the sliding direction indicating the sliding event is a downward sliding.
S105, when the sliding direction is the first direction, obtaining view data of a first array position in a first array list; the first array list is used for storing view data corresponding to the deleted view in a sliding mode.
In this specification embodiment, the first direction may be a direction opposite to a direction of sliding the deletion view, and when the sliding view component supports a lateral sliding, if the deletion view is slid leftward, the first direction may be set to be a rightward sliding; if the delete view is slid to the right, the first direction may be set to slide to the left. When the sliding view component supports longitudinal sliding, if the sliding view component slides upwards to delete the view, the first direction can be set to be downward sliding; if the delete view is slid down, the first direction may be set to slide up.
In this embodiment of the present specification, the first array list is used to store view data corresponding to the view deleted by sliding, and the data in the first array list is not encapsulated in the sliding view component. In practical applications, the view data in the first array list may be arranged according to the deletion time of the sliding deletion view, for example, the view data may be arranged in a descending order according to the difference between the deletion time and the current time, that is, the view data closest to the current time is arranged at the end position of the first array list the farther the view data closer to the current time is arranged. Of course, the view data may also be arranged in ascending order according to the difference between the deletion time and the current time, that is, the view data closer to the current time is arranged at the head of the first array list, and the view data closest to the current time is arranged at the head of the first array list.
It should be noted that, the above is only an example of sorting the view data in the first array list, and in practical applications, the view data in the first array list may also be sorted according to other conditions, which is not limited in this invention.
In this specification embodiment, the first list position may be any position in the first array list. Considering that in practical applications, the view that the user wants to display in a rolling back mode is generally the view that is deleted recently, therefore, preferably, the first array list position may be the position in the first array list where the view data with the deletion time closest to the current time is stored. For example, when the view data in the first array list is arranged in descending order according to the difference between the deletion time and the current time, the first list position may be the end position of the first array list; when the view data in the first array list are arranged in ascending order according to the difference between the deletion time and the current time, the first list position may be the first position of the first array list.
In some embodiments, after the view data at the first list position in the first array list is acquired, the view data corresponding to the first list position in the first array list may also be deleted.
S107, adding the view data of the first list position to a second list position in a second array list corresponding to the sliding view component.
In this embodiment of the present specification, the second array list is bound to the sliding view component, that is, the data in the second array list is encapsulated in the sliding view component, and the second array list is used for storing the view data of the view to be displayed in the sliding view component. The position of the second list can be set according to actual needs.
Taking the sliding view component as the recycle view, a preset rendering position of the second list may be set when creating a swipecardlayout manager (sliding view layout manager), and the second list position is included in the preset rendering position, so that a view corresponding to the view data of the second list position may be rendered and displayed in a subsequent rendering process. In the embodiments of the present specification, preferably, the position of the second list is the first position of the second array list.
Of course, it is understood that the preset rendering position of the second group list set in the swipecardlayout manager may include other multiple list positions in addition to the second list position. In one example, the preset rendering position of the second data list set in the swipecardlayout manager (sliding view layout manager) includes two consecutive list positions, namely, a first position of the second group list and a list position after the first position, where the first position is used as the second list position for storing the view data in the first list position, which is beneficial to saving memory space to be occupied by subsequent view rendering.
S109, rendering and displaying the sliding view component according to the view data of the second list position.
In the embodiment of the present specification, since the view data stored in the second list position is the view data of the first list position, that is, the view data of one view deleted by sliding. When the sliding view component is rendered and displayed according to the view data of the second list position, the sliding deleted view corresponding to the view data can be displayed again, and the backspacing display effect of the sliding deleted view is realized.
Specifically, when the sliding view component is rendered and displayed according to the view data in the second list position, a preset rendering position of the second array list may be obtained, where the preset rendering position includes the second list position, and then the sliding view component is rendered and displayed according to the view data in the second array list corresponding to the preset rendering position. Taking the sliding view component as a reclerview as an example, the preset rendering position may be obtained from swipecardlayout manager.
According to the technical scheme of the embodiment of the invention, the embodiment of the invention realizes the rollback and redisplay of the view which is deleted by sliding operation, so that the singleness of the function realization of the application program which displays the view based on the sliding operation is avoided, and the interaction between a user and the display interface of the application program is more convenient.
In practical applications, in order to prevent sudden flashing when the view component is moved back for deletion by sliding, before rendering and displaying the sliding view component according to the view data of the second list position, as shown in fig. 2, the method may further include:
s201, calling back a function to be drawn of the drawing monitoring interface.
In practical applications, a reference of an object created by a class using an interface can be given to an interface variable declared by the interface, and the interface variable can call a function of the interface implemented by the class. When the interface variable calls a function in the interface implemented by the class, the corresponding object is notified to call the function of the interface, and the process is called callback.
S203, in response to the drawing function to be drawn of the callback drawing monitoring interface, initializing and setting an initial touch coordinate parameter, an initial sliding distance parameter and an initial selection object in a sliding auxiliary class of the sliding view component.
In embodiments of the present description, a sliding assistance class is an assistance class that can be used in conjunction with a sliding view component to achieve the effect of sliding the delete view sideways.
Specifically, when an initial touch coordinate parameter in the sliding assistance class of the sliding view component is initially set, a coordinate value at the start of sliding in the sliding event and a side length value of the sliding view component may be obtained; determining the sum of the coordinate value at the beginning of sliding and the side length value of the sliding view component; and using the sum value as the initial touch coordinate parameter. The coordinate value at the start of sliding and the side length value of the sliding view component may be set according to the sliding direction supported by the sliding view component. When the sliding view component supports transverse sliding, the coordinate value at the beginning of sliding can be an abscissa value, and the side length value of the sliding view component can be a width value of the sliding view component; when the sliding view component supports longitudinal sliding, the coordinate value at the beginning of sliding may be a longitudinal coordinate value, and the side length value of the sliding view component may be a height value of the sliding view component.
When the initial sliding distance parameter in the sliding auxiliary class of the sliding view component is initialized, the side length value of the sliding view component can be obtained; and taking the negative number of the edge length value of the sliding view component as the initial sliding distance parameter, for example, if the edge length value is 5, the negative number corresponding to the edge length value is-5. The side length value of the sliding view component can be set according to the sliding direction supported by the sliding view component. When the sliding view component supports transverse sliding, the side length value of the sliding view component may be the width value of the sliding view component; when the sliding view component is to support vertical sliding, the side length value of the sliding view component may be the height value of the sliding view component.
When initial setting is performed on an initial selection object in the sliding assistance class of the sliding view component, a view container (viewholder) corresponding to the view data at the second list position may be acquired; and taking the view container corresponding to the view data of the second list position as the initial selection object. For example, when the position of the second list is the first position of the second array list, the view container (viewer) corresponding to the view data of the first position may be used as the initial selection object.
According to the embodiment of the invention, the initial touch coordinate parameter, the initial sliding distance parameter and the initial selection object in the sliding auxiliary class of the sliding view component are initialized, so that the flash condition of the view deleted by sliding in the backspacing display process can be avoided, the backspacing displayed view can be displayed in a continuous animation mode from the edge of the sliding view component corresponding to the first direction, and the experience effect of a user is enhanced.
Referring to fig. 3, a flow chart of another view component display method according to an embodiment of the present invention is shown, and as shown in fig. 3, the method may include:
s301, acquiring the sliding event monitored by the sliding view component.
S303, determining the sliding direction of the sliding event.
S305, when the sliding direction is a first direction, obtaining view data of a first array position in a first array list; the first array list is used for storing view data corresponding to the deleted view in a sliding mode.
S307, adding the view data of the first list position to a second list position in a second array list corresponding to the sliding view component.
S309, rendering and displaying the sliding view component according to the view data of the second list position.
The details of steps S301 to S309 may refer to the contents of the corresponding steps in the embodiment of the method shown in fig. 1, and are not described herein again.
S311, when the sliding direction is a second direction, moving the view data corresponding to the currently displayed view in the second array list to the first array list.
Specifically, the second direction is a direction in which the currently displayed view is set to be deleted by sliding, and may be a direction opposite to the first direction, and the currently displayed view is deleted by sliding by moving the view data corresponding to the currently displayed view in the second array list into the first array list.
S313, rendering and displaying the sliding view component according to the moved view data in the second array list.
Specifically, when the sliding view component is rendered and displayed according to the moved view data in the second array list, the currently displayed view can be switched to the view corresponding to the next view data in the second array list, so that the view switching after the sliding deletion is realized.
According to the technical scheme of the embodiment of the invention, the sliding deletion of the view and the sliding back display of the deleted view are realized through the sliding operation, so that the singleness of the realization of the function of the application program for displaying the view based on the sliding operation is avoided, and the interaction between a user and the display interface of the application program is more convenient.
To more clearly illustrate the view component display method according to the embodiment of the present invention, the following takes a sliding view component as a recycle view, a first direction for implementing sliding back to display a deleted view is sliding right, a second direction for implementing sliding to delete the view is sliding left, and a sliding assistance class of the recycle view is itemtoucherper as an example, as shown in fig. 4, the method may include:
s401, the custom SwipeeRecyclerView monitors and processes the left and right slide event in the dispatch TouchEvent () callback.
In the embodiment of the present specification, the swipsercreviview inherits the recterview. When the SwipeRecycleView is customized, a SwipeCardLayoutManager inheriting the LayoutManager is customized, and the stack view is laid out in the onLayoutChildren () callback in combination with the SwipeRecycleView.
S403, when it is monitored in the displatcouchevent () callback that it is a rightward swipe, moves the view data of the end position in mRemovedData to the head position in mSwipeCardData.
It should be noted that the movement here corresponds to removal and addition. Wherein, mRemovedData is an array list used for storing view data corresponding to the view deleted by sliding; the mSwipeCardData is view data for storing a view to be displayed in the swiprecycleview.
S405, call back onPreDraw () of onpredawlistener ().
S407, in response to onPreDraw () of the callback onpredawlistener (), sets mlnitialtouchx, mDx and mselect are initialized.
Specifically, the initialization setting for mlnitialtouchx enables a view to be rolled back to slide out from an edge, and the sum of the width value of the swipsecyclereviview and the abscissa at the start of sliding is taken as mlnitialtouchx when the view is implemented.
For the initialization setting of mDx, getSelectdDxDy (mTmpPosition) in the select () method in ItemTouchHelper may be made to obtain currentTranslateX as the negative SwipeRecycleView width value. In implementation, the negative number of the width value of swipsecycleview may be mDx.
The initialization setting for mSelected may allow the first call to the select () method in ItemTouchHelper to enter a determination of the initialization of the recovery animation in ItemTouchHelper. In implementation, view holder of the view corresponding to the view data at the head of the mswipeCardData may be used as mselect.
S409, rendering and displaying the SwipeRecycleView according to the view data of the mSwipeCardData head position.
Specifically, notifyDataSetChanged () may be called to perform rendering display of swipsecycleview.
In practical application, in order to reduce the memory space occupied by the rendering data, the rendering position in the mSwipeCardData is set to be two positions, namely 0 bit and 1 bit, in the swipecardlayout manager, and the two positions respectively represent the head position of the mSwipeCardData and the next list position next to the head position.
FIG. 5(a) is an interface display of a sliding view component before sliding back, wherein the currently displayed view of the SwipeRecycleView is View A; FIG. 5(B) is the interface display of the deleted view B during the rollback process when the finger slides to the right on the screen, wherein the view data corresponding to the deleted view B is located at the 0 bit, i.e. head position, of mSapepCardData, and the view data corresponding to the view A is located at the 1 bit, i.e. next list position, of mSapepCardData; fig. 5(c) shows the interface display when the deleted view B finishes rolling back after the finger slides right on the screen and leaves the screen.
S411, when it is monitored in the dismatcoutchouchvent () callback that it is a leftward swipe, moves the view data at the head position of mSwipeCardData to the end position of mRemovedData.
It should be noted that the moving to this point corresponds to removing and adding, so that there is no more view data of the currently displayed view in the mswipeCardData after the moving, and at this time, the view data of the list position next to the original 1 position, i.e. the head position, in the mswipeCardData is changed to the view data of the 0 position, i.e. the head position.
S413, rendering and displaying the SwipeRecycleView according to the view data of the mSwipeCardData head position.
Rendering and displaying the SwipeRecycleView, thereby deleting the previous view and switching the currently displayed view to the view corresponding to the view data of the next list position in the mNeweCardData.
According to the technical scheme of the embodiment of the invention, the sliding deletion of the view and the sliding back display of the deleted view are realized through the sliding operation, so that the singleness of the realization of the function of the application program for displaying the view based on the sliding operation is avoided, and the interaction between a user and the display interface of the application program is more convenient.
Corresponding to the view component display methods provided in the foregoing embodiments, embodiments of the present invention further provide a view component display apparatus, and since the view component display apparatus provided in the embodiments of the present invention corresponds to the view component display methods provided in the foregoing embodiments, the foregoing embodiments of the view component display method are also applicable to the view component display apparatus provided in the embodiments, and are not described in detail in the embodiments.
Referring to fig. 6, which is a schematic structural diagram of a view component display device according to an embodiment of the present invention, as shown in fig. 6, the device may include: a first obtaining module 610, a first determining module 620, a second obtaining module 630, an adding module 640, and a first rendering and displaying module 650, wherein,
a first obtaining module 610, configured to obtain a sliding event monitored by a sliding view component;
a determining module 620, configured to determine a sliding direction of the sliding event;
a second obtaining module 630, configured to obtain, when the sliding direction is a first direction, view data at a first list position in the first array list; the first array list is used for storing view data corresponding to the view deleted in a sliding mode;
an adding module 640, configured to add the view data at the first list position to a second list position in a second array list corresponding to the sliding view component;
a first rendering and displaying module 650, configured to render and display the sliding view component according to the view data of the second list position.
In some embodiments, the rendering display module 650 is specifically configured to: acquiring a preset rendering position of the second array list; the preset rendering position comprises the second list position; and rendering and displaying the sliding view component according to the view data in the second array list corresponding to the preset rendering position.
Optionally, as another schematic structural diagram of a view component display apparatus provided in fig. 7, the apparatus may further include:
the callback module 660 is used for calling back a to-be-drawn function of the drawing monitoring interface;
an initialization setting module 670, configured to perform initialization setting on an initial touch coordinate parameter, an initial sliding distance parameter, and an initial selection object in the sliding assistance class of the sliding view component in response to the drawing-to-be-performed function of the callback drawing listening interface.
In some embodiments, the initialization setting module 670 obtains the coordinate value of the sliding event at the start of sliding and the side length value of the sliding view component when performing initialization setting on the initial touch coordinate parameter in the sliding assistance class of the sliding view component; determining the sum of the coordinate value at the beginning of sliding and the side length value of the sliding view component; and using the sum value as the initial touch coordinate parameter.
In some embodiments, the initialization setting module 670 obtains a side length value of the sliding view component when performing initialization setting on an initial sliding distance parameter in the sliding assistance class of the sliding view component; and taking the negative number of the edge length value of the sliding view component as the initial sliding distance parameter.
In some embodiments, the initialization setting module 670 obtains a view container corresponding to the view data in the second list position when performing initialization setting on an initial selection object in the sliding assistance class of the sliding view component; and taking the view container corresponding to the view data of the second list position as the initial selection object.
In some embodiments, as another schematic structural view of a view assembly display apparatus provided in fig. 8, the apparatus may further include:
the deleting module 680 is configured to delete the view data corresponding to the first list position in the first array list after obtaining the view data of the first list position in the first array list.
In other embodiments, as shown in fig. 8, the apparatus may further include:
a moving module 810, configured to move, when the sliding direction is a second direction, view data in the second array list corresponding to a currently displayed view into the first array list;
and a second rendering and displaying module 820, configured to render and display the sliding view component according to the moved view data in the second group list.
It should be noted that, when the apparatus provided in the foregoing embodiment implements the functions thereof, only the division of the functional modules is illustrated, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the apparatus may be divided into different functional modules to implement all or part of the functions described above.
The view component display device of the embodiment of the invention realizes sliding deletion of the view through sliding operation and sliding backspacing display of the deleted view, so that the singleness of the realization of the function of the application program for displaying the view based on the sliding operation is avoided, and the interaction between a user and the display interface of the application program is more convenient.
Referring to fig. 9, a schematic structural diagram of a terminal according to an embodiment of the present invention is shown, where the terminal is configured to implement the view component display method provided in the foregoing embodiment. Specifically, the method comprises the following steps:
the terminal 900 may include RF (Radio Frequency) circuitry 910, memory 920 including one or more computer-readable storage media, an input unit 930, a display unit 940, a video sensor 950, audio circuitry 960, a WiFi (wireless fidelity) module 970, a processor 980 including one or more processing cores, and a power supply 90. Those skilled in the art will appreciate that the terminal structure shown in fig. 9 does not constitute a limitation of the terminal, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the RF circuit 910 may be used for receiving and transmitting signals during a message transmission or call, and in particular, for receiving downlink information from a base station and then processing the received downlink information by the one or more processors 980; in addition, data relating to uplink is transmitted to the base station. In general, RF circuit 910 includes, but is not limited to, an antenna, at least one Amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like. In addition, the RF circuit 910 may also communicate with networks and other devices via wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communications), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), and the like.
The memory 920 may be used to store software programs and modules, and the processor 980 performs various functional applications and data processing by operating the software programs and modules stored in the memory 920. The memory 920 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as video data, a phone book, etc.) created according to the use of the terminal 900, and the like. Further, the memory 920 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 920 may also include a memory controller to provide the processor 980 and the input unit 930 with access to the memory 920.
The input unit 930 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. Specifically, the input unit 930 may include an image input device 931 and other input devices 932. The image input device 931 may be a camera or a photoelectric scanning device. The input unit 930 may include other input devices 932 in addition to the image input device 931. In particular, other input devices 932 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 940 may be used to display information input by or provided to the user and various graphical user interfaces of the terminal 900, which may be made up of graphics, text, icons, video, and any combination thereof. The Display unit 940 may include a Display panel 941, and optionally, the Display panel 941 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like.
Terminal 900 can include at least one video sensor 950 for obtaining video information of a user. Terminal 900 can also include other sensors (not shown), such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 941 according to the brightness of ambient light, and a proximity sensor that may turn off the display panel 941 and/or a backlight when the terminal 900 is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when the mobile phone is stationary, and can be used for applications of recognizing the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured in the terminal 900, detailed descriptions thereof are omitted.
WiFi belongs to a short-distance wireless transmission technology, and the terminal 900 can help a user send and receive e-mails, browse webpages, access streaming media and the like through the WiFi module 970, which provides the user with wireless broadband internet access. Although fig. 9 shows the WiFi module 970, it is understood that it does not belong to the essential constitution of the terminal 900 and can be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 980 is a control center of the terminal 900, connects various parts of the entire mobile phone using various interfaces and lines, and performs various functions of the terminal 900 and processes data by operating or executing software programs and/or modules stored in the memory 920 and calling data stored in the memory 920, thereby integrally monitoring the mobile phone. Optionally, processor 980 may include one or more processing cores; preferably, the processor 980 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 980.
The terminal 900 also includes a power supply 90 (e.g., a battery) for powering the various components, which may preferably be logically connected to the processor 980 via a power management system that provides management of charging, discharging, and power consumption. The power supply 90 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
Although not shown, the terminal 900 may further include a bluetooth module or the like, which is not described in detail herein.
In this embodiment, the terminal 900 further includes a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors. The one or more programs include instructions for performing the view component display method provided by the method embodiments described above.
Embodiments of the present invention further provide a storage medium, which may be disposed in a terminal to store at least one instruction, at least one program, a code set, or a set of instructions related to implementing a view component display method in the method embodiments, where the at least one instruction, the at least one program, the code set, or the set of instructions are loaded and executed by the processor to implement the view component display method provided in the method embodiments.
Alternatively, in this embodiment, the storage medium may be located in at least one network server of a plurality of network servers of a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.
Claims (9)
1. A method for displaying a view component, the method comprising:
acquiring a sliding event monitored by a sliding view component;
determining a sliding direction of the sliding event;
when the sliding direction is a first direction, acquiring view data of a first array position in a first array list; the first array list is used for storing view data corresponding to the view deleted in a sliding mode;
adding the view data of the first list position to a second list position in a second array list corresponding to the sliding view component; wherein the second array list is bound with the sliding view component and is used for storing view data of the view to be displayed in the sliding view component;
rendering and displaying the sliding view component according to the view data of the second list position;
when the sliding direction is a second direction, moving the view data corresponding to the currently displayed view in the second array list to the first array list, so as to delete the currently displayed view in a sliding manner;
and rendering and displaying the sliding view component according to the moved view data in the second array list, so that the currently displayed view is switched to the view corresponding to the next view data in the second array list.
2. The view component displaying method according to claim 1, wherein said rendering and displaying the sliding view component according to the view data of the second list position includes:
acquiring a preset rendering position of the second array list; the preset rendering position comprises the second list position;
and rendering and displaying the sliding view component according to the view data in the second array list corresponding to the preset rendering position.
3. The view component displaying method according to claim 1, wherein before rendering and displaying the sliding view component according to the view data of the second list position, the method further comprises:
calling back a function to be drawn of the drawing monitoring interface;
and responding to the drawing-to-be-performed function of the callback drawing monitoring interface, and carrying out initialization setting on an initial touch coordinate parameter, an initial sliding distance parameter and an initial selection object in a sliding auxiliary class of the sliding view component.
4. The view component display method according to claim 3, wherein the initializing the initial touch coordinate parameter in the sliding assistance class of the sliding view component comprises:
obtaining coordinate values when sliding starts in the sliding event and side length values of the sliding view assembly;
determining the sum of the coordinate value at the beginning of sliding and the side length value of the sliding view component;
and using the sum value as the initial touch coordinate parameter.
5. The view component display method according to claim 3, wherein the initializing an initial sliding distance parameter in a sliding assistance class of the sliding view component comprises:
acquiring a side length value of the sliding view component;
and taking the negative number of the edge length value of the sliding view component as the initial sliding distance parameter.
6. The view component display method according to claim 3, wherein the initializing an initially selected object in the sliding assistance class of the sliding view component comprises:
acquiring a view container corresponding to the view data of the second list position;
and taking the view container corresponding to the view data of the second list position as the initial selection object.
7. The view component display method of claim 1, wherein after obtaining the view data for the first list position in the first array list, the method further comprises:
and deleting the view data corresponding to the first array list position in the first array list.
8. A view component display apparatus, the apparatus comprising:
the first acquisition module is used for acquiring a sliding event monitored by the sliding view component;
a determination module for determining a sliding direction of the sliding event;
the second obtaining module is used for obtaining view data of a first array position in the first array list when the sliding direction is the first direction; the first array list is used for storing view data corresponding to the view deleted in a sliding mode;
an adding module, configured to add the view data at the first list position to a second list position in a second array list corresponding to the sliding view component; wherein the second array list is bound with the sliding view component and is used for storing view data of the view to be displayed in the sliding view component;
the first rendering and displaying module is used for rendering and displaying the sliding view component according to the view data of the second list position; when the sliding direction is a second direction, moving the view data corresponding to the currently displayed view in the second array list to the first array list, so as to delete the currently displayed view in a sliding manner;
and rendering and displaying the sliding view component according to the moved view data in the second array list, so that the currently displayed view is switched to the view corresponding to the next view data in the second array list.
9. A terminal comprising a processor and a memory, the memory having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions, the at least one instruction, the at least one program, the set of codes, or the set of instructions being loaded and executed by the processor to implement the view component display method of any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910284482.0A CN111813296B (en) | 2019-04-10 | 2019-04-10 | View component display method and device and terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910284482.0A CN111813296B (en) | 2019-04-10 | 2019-04-10 | View component display method and device and terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111813296A CN111813296A (en) | 2020-10-23 |
CN111813296B true CN111813296B (en) | 2022-01-14 |
Family
ID=72844485
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910284482.0A Active CN111813296B (en) | 2019-04-10 | 2019-04-10 | View component display method and device and terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111813296B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112527175A (en) * | 2020-10-30 | 2021-03-19 | 百果园技术(新加坡)有限公司 | Animation implementation method, device, equipment and storage medium |
CN114443198B (en) * | 2022-01-26 | 2024-03-29 | 阿里巴巴(中国)有限公司 | View assembly management method, device, storage medium and computer program product |
CN117093110B (en) * | 2023-10-20 | 2024-04-05 | 荣耀终端有限公司 | Background image display method and electronic equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102799421A (en) * | 2011-05-25 | 2012-11-28 | 腾讯科技(深圳)有限公司 | Multi-view switching system and method |
CN103019589A (en) * | 2012-11-26 | 2013-04-03 | 广东欧珀移动通信有限公司 | Method for deleting list items in sliding manner |
CN103699624A (en) * | 2013-12-19 | 2014-04-02 | 北京奇虎科技有限公司 | Browser data processing method and device |
CN103970526A (en) * | 2013-11-21 | 2014-08-06 | 成都力淼科技有限公司 | Android based single-activity view switching technology |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10712913B2 (en) * | 2014-10-20 | 2020-07-14 | Oracle International Corporation | Event-based architecture for expand-collapse operations |
-
2019
- 2019-04-10 CN CN201910284482.0A patent/CN111813296B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102799421A (en) * | 2011-05-25 | 2012-11-28 | 腾讯科技(深圳)有限公司 | Multi-view switching system and method |
CN103019589A (en) * | 2012-11-26 | 2013-04-03 | 广东欧珀移动通信有限公司 | Method for deleting list items in sliding manner |
CN103970526A (en) * | 2013-11-21 | 2014-08-06 | 成都力淼科技有限公司 | Android based single-activity view switching technology |
CN103699624A (en) * | 2013-12-19 | 2014-04-02 | 北京奇虎科技有限公司 | Browser data processing method and device |
Also Published As
Publication number | Publication date |
---|---|
CN111813296A (en) | 2020-10-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10419823B2 (en) | Method for controlling multimedia playing, apparatus thereof and storage medium | |
CN106406712B (en) | Information display method and device | |
US8650501B2 (en) | User interface with preview transitions | |
CN108549519B (en) | Split screen processing method and device, storage medium and electronic equipment | |
CN109062467B (en) | Split screen application switching method and device, storage medium and electronic equipment | |
CN104298558B (en) | Information processing method and device | |
CN105786878B (en) | Display method and device of browsing object | |
CN108021316B (en) | Message display method and device | |
CN108984064B (en) | Split screen display method and device, storage medium and electronic equipment | |
CN104571979B (en) | A kind of method and apparatus for realizing split view | |
WO2015014305A1 (en) | Method and apparatus for presenting clipboard contents on a mobile terminal | |
CN110941750B (en) | Data linkage method and related device | |
CN108156508B (en) | Barrage information processing method and device, mobile terminal, server and system | |
CN105975190B (en) | Graphical interface processing method, device and system | |
WO2020007114A1 (en) | Method and apparatus for switching split-screen application, storage medium, and electronic device | |
CN111813296B (en) | View component display method and device and terminal | |
EP3916529A1 (en) | Message sending method, and terminal device | |
CN110879680B (en) | Icon management method and electronic equipment | |
CN104142779A (en) | UI (user interface) control method and device as well as terminal | |
US20150089431A1 (en) | Method and terminal for displaying virtual keyboard and storage medium | |
CN108932094A (en) | Split screen application switching method, device, storage medium and electronic equipment | |
CN108536349B (en) | Icon management method and mobile terminal | |
CN108564539B (en) | Method and device for displaying image | |
CN110908757B (en) | Method and related device for displaying media content | |
CN105095259B (en) | Waterfall flow object display method and device |
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 | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 40030877 Country of ref document: HK |
|
GR01 | Patent grant | ||
GR01 | Patent grant |