Movatterモバイル変換


[0]ホーム

URL:


CN112835499B - Carousel graph display method, device, equipment and medium - Google Patents

Carousel graph display method, device, equipment and medium
Download PDF

Info

Publication number
CN112835499B
CN112835499BCN202110113684.6ACN202110113684ACN112835499BCN 112835499 BCN112835499 BCN 112835499BCN 202110113684 ACN202110113684 ACN 202110113684ACN 112835499 BCN112835499 BCN 112835499B
Authority
CN
China
Prior art keywords
picture
scrollview
sub
component
sequence
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110113684.6A
Other languages
Chinese (zh)
Other versions
CN112835499A (en
Inventor
马黎明
黄明远
康浪浪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiaoma Guoju Yuxi Technology Co ltd
Original Assignee
Xiaoma Guoju Yuxi Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiaoma Guoju Yuxi Technology Co ltdfiledCriticalXiaoma Guoju Yuxi Technology Co ltd
Priority to CN202110113684.6ApriorityCriticalpatent/CN112835499B/en
Publication of CN112835499ApublicationCriticalpatent/CN112835499A/en
Application grantedgrantedCritical
Publication of CN112835499BpublicationCriticalpatent/CN112835499B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The application discloses a carousel graph display method, a carousel graph display device, carousel graph display equipment and a carousel graph display medium, wherein the method comprises the following steps: initializing resources to be displayed in the carousel graph, and rendering a sliding device taking a ScrollView component as a parent container; rendering a sub-picture sequence for the ScrollView component, and rendering a brother container View of the ScrollView component to use the brother container View as a carrier of the small dot sequence and the page number; and mounting the ScrollView component, starting a timer, and moving the pictures in the sub-picture sequence by the width of the actual display area along a preset direction if a sliding instruction triggered by the dragging action of a user is not detected every time the timer reaches a preset time so as to sequentially display the pictures to be displayed in the sub-picture sequence in a carousel manner. Can solve like this because of set up the carousel mistake problem that the outside margin leads to when the carousel picture demonstrates, promote user experience.

Description

Carousel graph display method, device, equipment and medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a carousel map display method, apparatus, device, and medium.
Background
With the maturity of the front-end development technology, a better page experience effect is particularly important, and applications using carousel pictures in pages are more visible everywhere. In the prior art, a read-Native is usually used as a JavaScript cross-platform framework to realize a carousel map, but in this way, there are some problems that, when the carousel map is horizontally full of screens, display is normal, that is, each step is the width of a device display interface (that is, a current device screen), but if outer margins are added to the left and right sides of a parent container of the carousel map, carousel occurs in disorder, and the disorder is more serious with the increase of the number of pages of carousel, which seriously affects user experience.
Therefore, how to solve the problem of carousel errors caused by increasing the outer edge distance of the carousel map becomes an important problem to be solved by the technical personnel in the field.
Disclosure of Invention
In view of this, an object of the present application is to provide a carousel map display method, apparatus, device, and medium, which can solve the problem of carousel errors caused by setting an outer margin during carousel map display, and improve user experience. The specific scheme is as follows:
in a first aspect, the present application discloses a carousel map display method, including:
initializing resources to be displayed in a carousel image, and rendering a sliding device which takes a ScrollView component as a parent container, wherein the resources to be displayed comprise pictures to be displayed and page numbers of the pictures to be displayed;
rendering a sub-picture sequence for the ScrollView component, rendering a sibling container View of the ScrollView component, and taking the sibling container View as a small circle point sequence and a carrier of the page number, wherein the sub-picture sequence is obtained by arranging the pictures to be displayed according to the sequence of the page number, the width of each frame of picture in the sub-picture sequence is the width of an actual display area, the width of the actual display area is determined based on the width of a current device display interface and the outer edge distance of the current device display interface, and the small circle point sequence is used for representing the position of the current display picture in the sub-picture sequence;
and mounting the ScrollView component, starting a timer, and moving the pictures in the sub-picture sequence by the width of the actual display area along a preset direction if a sliding instruction triggered by a user dragging behavior is not detected every time the timer reaches a preset time so as to sequentially display the pictures to be displayed in the sub-picture sequence in a carousel manner.
Optionally, the rendering a sliding device with a ScrollView component as a parent container includes:
setting a preset value as a handle of the ScrollView component;
acquiring the handle, and setting the attribute of the ScrollView component;
optionally, the setting the attribute of the scrillview component includes:
setting a horizontal attribute of the ScrollView component as a carousel graph to slide transversely;
setting the property of the showsHorizontalScrollindicator of the ScrollView component as a scroll bar not to be displayed;
setting the pageEnabled attribute of the ScrollView component to be stopped at the position of integral multiple of the size of the scroll view by the scroll bar;
and setting an onMomentumScrollEnd attribute, an onScrollBeginDrag attribute and an onScrollEndDrag attribute for the ScrollView component.
Optionally, after moving the pictures in the sub-picture sequence by the width of the actual display area along a preset direction, the method further includes:
updating the small dot sequence according to the page number of the current display picture;
and updating the page number of the current display picture to the state machine.
Optionally, the carousel graph displaying method further includes:
if a sliding instruction triggered by a user dragging behavior is detected, clearing the timer, and sliding to a target picture to be displayed in the sub-picture sequence according to the sliding instruction so as to take the target picture to be displayed as a current display picture;
updating the small dot sequence according to the page number of the current display picture when the picture to be displayed is slid every time, and updating the page number of the current display picture to a state machine;
and when the user dragging behavior is finished, restarting the timer so as to perform automatic carousel display on the to-be-displayed picture in the sub-picture sequence.
Optionally, the rendering a sub-picture sequence for the ScrollView component includes:
rendering a sub-picture sequence for the ScrollView component;
and setting the width of each frame of picture in the sub-picture sequence as the width of an actual display area.
Optionally, before setting the width of each frame picture in the sub-picture sequence to be the width of an actual display area, the method further includes:
determining the sum of the outer edge distances of a current equipment display interface;
and taking the difference value of the width of the display interface of the current equipment and the sum of the outer margin as the width of the actual display area.
In a second aspect, the present application discloses a carousel map display device, including:
the device comprises an initialization module, a display module and a display module, wherein the initialization module is used for initializing resources to be displayed in a carousel image and rendering a sliding device which takes a ScrollView component as a parent container, and the resources to be displayed comprise pictures to be displayed and page numbers of the pictures to be displayed;
a rendering module, configured to render a sub-picture sequence for the ScrollView component, render a sibling container View of the ScrollView component, and use the sibling container View as a carrier of a small circle sequence and the page number, where the sub-picture sequence is obtained by arranging the pictures to be displayed according to the order of the page number, a width of each frame of picture in the sub-picture sequence is a width of an actual display area, the width of the actual display area is determined based on a width of a display interface of a current device and an outer edge distance of a display interface of the current device, and the small circle sequence is used to represent a position of the current display picture in the sub-picture sequence;
and the carousel module is used for mounting the ScrollView component and starting a timer, and when the timer reaches preset time each time, if a sliding instruction triggered by a user dragging behavior is not detected, moving the pictures in the sub-picture sequence by the width of the actual display area along a preset direction so as to sequentially display the pictures to be displayed in the sub-picture sequence in a carousel manner.
In a third aspect, the present application discloses an electronic device, comprising:
a memory and a processor;
wherein the memory is used for storing a computer program;
the processor is configured to execute the computer program to implement the carousel map display method disclosed in the foregoing.
In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the carousel map presentation method disclosed in the foregoing.
As can be seen, in the present application, a resource to be displayed in a carousel View is initialized, a sliding device with a ScrollView component as a parent container is rendered, wherein the resource to be displayed includes a picture to be displayed and a page number of the picture to be displayed, a sub-picture sequence is rendered for the ScrollView component, a sibling container View of the ScrollView component is rendered, the sibling container View is used as a carrier of a small dot sequence and the page number, wherein the sub-picture sequence is obtained by arranging the picture to be displayed according to a sequence of the page number, a width of each frame of the sub-picture sequence is a width of an actual display area, the width of the actual display area is determined based on a width of a current device display interface and an outer edge distance of a current device display interface, the small dot sequence is used for indicating a position of the current display picture in the sub-picture sequence, then the ScrollView component is hung, and a timer is started, and when the timer reaches a preset time, if a user does not detect a dragging behavior, a sliding command is triggered, the sliding device moves the sub-picture sequence along a display direction of the sub-picture to be displayed in the actual display area, and the display area is set in the display order of the sub-picture sequence. Therefore, when a sprite sequence is rendered for the ScrollView component, the width of each frame of picture in the sprite sequence is set to be the width of an actual display area, the width of the actual display area is determined based on the width of a display interface of current equipment and the outer edge distance of the display interface of the current equipment, and then after the ScrollView component is mounted and a timer is started, when the timer reaches preset time, if a sliding instruction triggered by a user dragging action is not detected, the pictures in the sprite sequence are moved along a preset direction by the width of the actual display area so as to sequentially display the pictures to be displayed in the sprite sequence in a carousel manner. Compared with the prior art, the width of the current equipment display interface is set when the current equipment display interface leaves the factory and cannot be changed, so that the picture display width cannot be changed, the width of each frame of picture is the width of an actual display area, the moving distance of the timer reaching the preset time along the preset direction is the width of the actual display area, the problem of carousel error caused by the fact that the outside margin is set during carousel picture display can be solved, and user experience is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only the embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a carousel map display method disclosed in the present application;
FIG. 2 is a schematic illustration of a carousel presentation disclosed herein;
fig. 3 is a flowchart of a specific carousel display method disclosed in the present application;
fig. 4 is a schematic structural view of a carousel display apparatus disclosed in the present application;
fig. 5 is a schematic structural diagram of an electronic device disclosed in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, an embodiment of the present application discloses a carousel graph display method, including:
step S11: initializing resources to be displayed in a carousel graph, and rendering a sliding device which takes a ScrollView component as a parent container, wherein the resources to be displayed comprise pictures to be displayed and page numbers of the pictures to be displayed.
In a specific implementation process, a resource to be displayed in a carousel map needs to be initialized first, and a sliding device using a ScrollView component as a parent container is rendered, wherein the resource to be displayed includes a picture to be displayed and a page number of the picture to be displayed.
That is, the resource to be displayed, specifically including the picture to be displayed and the page number on the picture to be displayed, needs to be prepared first.
Rendering a sliding device with the ScrollView component as a parent container is also needed. Specifically, a preset value is set as a handle of the ScrollView component; and acquiring the handle, and setting the attribute of the ScrollView component. Setting a preset value as a handle of the ScrollView component, which specifically may be: setting a ref value as a handle of the ScrollView component, acquiring the ref value to acquire the handle of the ScrollView component, and performing related operation on the ScrollView component, including setting the attribute of the ScrollView component.
Setting the attribute of the ScrollView component, including: setting a horizontal attribute of the ScrollView component as a carousel graph to slide transversely; setting the property of the showsHorizontalScrollindicator of the ScrollView component as a scroll bar not to be displayed; setting the pageEnabled attribute of the ScrollView component to be the position of the scroll bar stopping at the integral multiple of the size of the scroll view; and setting an onMomentumScrollEnd attribute, an onScrollBeginDrag attribute and an onScrollEndDrag attribute for the ScrollView component.
That is, the property settings of the ScrollView component can be specifically shown in the following Table I.
Watch 1
Figure BDA0002919836490000061
Step S12: rendering a sub-picture sequence for the ScrollView component, rendering a brother container View of the ScrollView component, and taking the brother container View as a small dot sequence and a carrier of the page number, wherein the sub-picture sequence is obtained by arranging the pictures to be displayed according to the sequence of the page number, the width of each frame of picture in the sub-picture sequence is the width of an actual display area, the width of the actual display area is determined based on the width of a display interface of the current device and the outer edge distance of the display interface of the current device, and the small dot sequence is used for representing the position of the current display picture in the sub-picture sequence.
In practical application, a sub-picture sequence needs to be rendered for the ScrollView component, that is, when the sliding direction is a horizontal direction relative to a user, the pictures to be displayed are arranged in a row according to the sequence of page numbers so as to be displayed in sequence, the width of each frame of picture in the sub-picture sequence is the width of an actual display area, the width of the actual display area is determined based on the width of a display interface of a current device and the outer edge distance of the display interface of the current device, the width of the display interface of the current device is also the screen width of the current device, that is, the outer edge distance can be set on the display interface of the current device.
Specifically, the rendering of the sub-picture sequence by the ScrollView component includes: rendering a sub-picture sequence for the ScrollView component; and setting the width of each frame of picture in the sub-picture sequence as the width of an actual display area. Before setting the width of each frame of picture in the sub-picture sequence as the width of an actual display area, the method further includes: determining the sum of the outer distances of the current equipment display interface; and taking the difference value of the width of the display interface of the current equipment and the sum of the outer margins as the width of the actual display area.
Rendering a sibling container View of the ScrollView component is further required so as to use a small dot sequence and the carrier of the page number, wherein the small dot sequence is used for representing the position of the current display picture in the sub-picture sequence. When the sliding direction is horizontal relative to a user, the number of small dots of the small dot sequence is the same as the number of pictures in the sub-picture sequence and is arranged in a row, when the current display picture is the first picture of the sub-picture sequence, the first small dot in the small dot sequence is selected to indicate that the current display picture is the first picture, and when the current display picture is the second picture in the sub-picture sequence, the second small dot in the small dot sequence is selected to indicate that the current display picture is the second picture.
Step S13: and mounting the ScrollView component, starting a timer, and moving the pictures in the sub-picture sequence by the width of the actual display area along a preset direction if a sliding instruction triggered by a user dragging behavior is not detected every time the timer reaches a preset time so as to sequentially display the pictures to be displayed in the sub-picture sequence in a carousel manner.
And then mounting the ScrollView component, starting a timer, so that when the timer reaches preset time each time, if a sliding instruction triggered by a user dragging behavior is not detected, moving the pictures in the sub-picture sequence by the width of the actual display area along a preset direction, and performing carousel display on the pictures to be displayed in the sub-picture sequence in sequence. Wherein the preset direction is a preset sliding direction. The preset direction may be to the left or right of the current device with respect to the user.
The total distance of movement of the currently displayed picture is the product of the page number of the currently displayed picture and the width of the actual display area. Referring to fig. 2, the page number is denoted by P, the sub-picture sequence includes pages P1, P2, and P3, the outer margin is MG, the width of the current device display interface (i.e., the screen width) is SW, the width of the actual display area is AW = (SW-MG = 2), the actual carousel width is AW, and the total sliding distance of the current display picture is HD, HD = P × AW = P (SW-MG = 2). P2 slides leftwards by the width of 2 AW, P3 follows the P2 to slide to supplement the position sliding distance to be 3 AW, and the page after the outer margin is set is normally slid by analogy without calculation error to cause page carousel diagram display dislocation.
As can be seen, in the present application, a resource to be displayed in a carousel View is initialized, a sliding device with a ScrollView component as a parent container is rendered, wherein the resource to be displayed includes a picture to be displayed and a page number of the picture to be displayed, a sub-picture sequence is rendered for the ScrollView component, a sibling container View of the ScrollView component is rendered, the sibling container View is used as a carrier of a small dot sequence and the page number, wherein the sub-picture sequence is obtained by arranging the picture to be displayed according to a sequence of the page number, a width of each frame of the sub-picture sequence is a width of an actual display area, the width of the actual display area is determined based on a width of a current device display interface and an outer edge distance of a current device display interface, the small dot sequence is used for indicating a position of the current display picture in the sub-picture sequence, then the ScrollView component is hung, and a timer is started, and when the timer reaches a preset time, if a user does not detect a dragging behavior, a sliding command is triggered, the sliding device moves the sub-picture sequence along a display direction of the sub-picture to be displayed in the actual display area, and the display area is set in the display order of the sub-picture sequence. Therefore, when the sprite sequence is rendered for the ScrollView component, the width of each frame of picture in the sprite sequence is set as the width of an actual display area, the width of the actual display area is determined based on the width of the display interface of the current device and the outer edge distance of the display interface of the current device, and then after the ScrollView component is mounted and the timer is started, if a sliding instruction triggered by a user dragging behavior is not detected every time the timer reaches a preset time, the pictures in the sprite sequence are moved by the width of the actual display area along a preset direction so as to sequentially display the pictures to be displayed in the sprite sequence in a carousel manner. Compared with the prior art, the width of the current equipment display interface is set when the current equipment display interface leaves the factory and cannot be changed, so that the picture display width cannot be changed, the width of each frame of picture is the width of an actual display area, the moving distance of the timer reaching the preset time along the preset direction is the width of the actual display area, the problem of carousel error caused by the fact that the outside margin is set during carousel picture display can be solved, and user experience is improved.
Referring to fig. 3, an embodiment of the present application discloses a specific carousel map display method, including:
step S21: initializing resources to be displayed in a carousel graph, and rendering a sliding device which takes a ScrollView component as a parent container, wherein the resources to be displayed comprise pictures to be displayed and page numbers of the pictures to be displayed.
Step S22: rendering a sub-picture sequence for the ScrollView component, rendering a brother container View of the ScrollView component, and taking the brother container View as a small dot sequence and a carrier of the page number, wherein the sub-picture sequence is obtained by arranging the pictures to be displayed according to the sequence of the page number, the width of each frame of picture in the sub-picture sequence is the width of an actual display area, the width of the actual display area is determined based on the width of a display interface of the current device and the outer edge distance of the display interface of the current device, and the small dot sequence is used for representing the position of the current display picture in the sub-picture sequence.
The specific implementation process of step S21 and step S22 may refer to the content disclosed in the foregoing embodiments, and details are not repeated here.
Step S23: and mounting the ScrollView component, starting a timer, and moving the pictures in the sub-picture sequence by the width of the actual display area along a preset direction if a sliding instruction triggered by a user dragging behavior is not detected every time the timer reaches a preset time so as to sequentially display the pictures to be displayed in the sub-picture sequence in a carousel manner.
And the ScrollView component is also required to be mounted, a timer is started, and when the timer reaches preset time each time, if a sliding instruction triggered by a user dragging behavior is not detected, the pictures in the sub-picture sequence are moved by the width of the actual display area along a preset direction, so that the pictures to be displayed in the sub-picture sequence are sequentially displayed in a carousel mode.
After moving the pictures in the sub-picture sequence by the width of the actual display area along a preset direction, the method further comprises the following steps: updating the small dot sequence according to the page number of the current display picture; and updating the page number of the current display picture to the state machine.
Step S24: and mounting the ScrollView component, starting a timer, clearing the timer if a sliding instruction triggered by a user dragging behavior is detected, and sliding to a target picture to be displayed in the sub-picture sequence according to the sliding instruction so as to take the target picture to be displayed as a current display picture.
And after the timer is started, if a sliding instruction triggered by a user dragging behavior is detected, the timer is cleared, and the target picture to be displayed in the sub-picture sequence is slid according to the sliding instruction so as to take the target picture to be displayed as the current display picture. The target picture is also a picture that the user wants to drag, that is, a picture that the user wants to see.
Step S25: and updating the small dot sequence according to the page number of the current display picture when the picture to be displayed is slid by one frame, and updating the page number of the current display picture to the state machine.
And in the process of sliding to the target picture, updating the small dot sequence according to the page number of the current display picture when the picture to be displayed is slid every time, and updating the page number of the current display picture to a state machine.
Step S26: and when the user dragging behavior is finished, restarting the timer so as to perform automatic carousel display on the to-be-displayed picture in the sub-picture sequence.
And when the user dragging behavior is finished, restarting the timer so as to automatically and alternately display the to-be-displayed pictures in the sub-picture sequence.
Referring to fig. 4, an embodiment of the present application discloses a carousel map display device, including:
the system comprises aninitialization module 11, a display module and a display module, wherein theinitialization module 11 is used for initializing resources to be displayed in a carousel image and rendering a sliding device which takes a ScrollView component as a parent container, and the resources to be displayed comprise pictures to be displayed and page numbers of the pictures to be displayed;
arendering module 12, configured to render a sub-picture sequence for the ScrollView component, render a sibling container View of the ScrollView component, and use the sibling container View as a carrier of a small circle sequence and the page number, where the sub-picture sequence is obtained by arranging the pictures to be displayed according to the order of the page number, a width of each frame of picture in the sub-picture sequence is a width of an actual display area, the width of the actual display area is determined based on a width of a display interface of a current device and an outer edge distance of the display interface of the current device, and the small circle sequence is used to represent a position of the current display picture in the sub-picture sequence;
and thecarousel module 13 is configured to mount the ScrollView component, start a timer, and move the pictures in the sub-picture sequence by the width of the actual display area along a preset direction if a sliding instruction triggered by a user dragging behavior is not detected every time the timer reaches a preset time, so as to sequentially carousel and display the pictures to be displayed in the sub-picture sequence.
As can be seen, in the present application, a resource to be displayed in a carousel View is initialized, a sliding device with a ScrollView component as a parent container is rendered, wherein the resource to be displayed includes a picture to be displayed and a page number of the picture to be displayed, a sub-picture sequence is rendered for the ScrollView component, a sibling container View of the ScrollView component is rendered, the sibling container View is used as a carrier of a small dot sequence and the page number, wherein the sub-picture sequence is obtained by arranging the picture to be displayed according to a sequence of the page number, a width of each frame of the sub-picture sequence is a width of an actual display area, the width of the actual display area is determined based on a width of a current device display interface and an outer edge distance of a current device display interface, the small dot sequence is used for indicating a position of the current display picture in the sub-picture sequence, then the ScrollView component is hung, and a timer is started, and when the timer reaches a preset time, if a user does not detect a dragging behavior, a sliding command is triggered, the sliding device moves the sub-picture sequence along a display direction of the sub-picture to be displayed in the actual display area, and the display area is set in the display order of the sub-picture sequence. Therefore, when the sprite sequence is rendered for the ScrollView component, the width of each frame of picture in the sprite sequence is set as the width of an actual display area, the width of the actual display area is determined based on the width of the display interface of the current device and the outer edge distance of the display interface of the current device, and then after the ScrollView component is mounted and the timer is started, if a sliding instruction triggered by a user dragging behavior is not detected every time the timer reaches a preset time, the pictures in the sprite sequence are moved by the width of the actual display area along a preset direction so as to sequentially display the pictures to be displayed in the sprite sequence in a carousel manner. Compared with the prior art, the width of the current equipment display interface is set when the current equipment display interface leaves the factory and cannot be changed, so that the picture display width cannot be changed, the width of each frame of picture is the width of an actual display area, the moving distance of the timer reaching the preset time along the preset direction is the width of the actual display area, the problem of carousel error caused by the fact that the outside margin is set during carousel picture display can be solved, and user experience is improved.
In some specific implementations, theinitialization module 11 is configured to:
setting a preset value as a handle of the ScrollView component;
and acquiring the handle, and setting the attribute of the ScrollView component.
In some specific implementations, theinitialization module 11 is configured to:
setting a horizontal attribute of the ScrollView component as a carousel map to slide transversely;
setting the property of the showsHorizontalScrollindicator of the ScrollView component as a scroll bar not to be displayed;
setting the pageEnabled attribute of the ScrollView component to be stopped at the position of integral multiple of the size of the scroll view by the scroll bar;
and setting an onMomentumScrollEnd attribute, an onScrollBeginDrag attribute and an onScrollEndDrag attribute for the ScrollView component.
In some specific implementations, thecarousel module 13 is further configured to:
updating the small dot sequence according to the page number of the current display picture;
and updating the page number of the current display picture to the state machine.
In some specific implementations, thecarousel module 13 is further configured to:
if a sliding instruction triggered by the user dragging behavior is detected, clearing the timer, and sliding to a target to-be-displayed picture in the sub-picture sequence according to the sliding instruction so as to take the target to-be-displayed picture as a current display picture;
updating the small dot sequence according to the page number of the current display picture when the picture to be displayed is slid every time, and updating the page number of the current display picture to a state machine;
and when the user dragging behavior is finished, restarting the timer so as to perform automatic carousel display on the to-be-displayed picture in the sub-picture sequence.
In some specific implementations, therendering module 12 is configured to:
rendering a sub-picture sequence for the ScrollView component;
and setting the width of each frame of picture in the sub-picture sequence as the width of an actual display area.
In some specific implementations, therendering module 12 is configured to:
determining the sum of the outer distances of the current equipment display interface;
and taking the difference value of the width of the display interface of the current equipment and the sum of the outer margins as the width of the actual display area.
Referring to fig. 5, a schematic structural diagram of anelectronic device 20 provided in the embodiment of the present application is shown, where theelectronic device 20 may specifically implement the steps of the carousel map displaying method described above.
In general, theelectronic device 20 in the present embodiment includes: aprocessor 21 and a memory 22.
Theprocessor 21 may include one or more processing cores, such as a four-core processor, an eight-core processor, and so on. Theprocessor 21 may be implemented by at least one hardware component selected from a DSP (digital signal processing), an FPGA (field-programmable gate array), and a PLA (programmable logic array). Theprocessor 21 may also include a main processor and a coprocessor, where the main processor is a processor for processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, theprocessor 21 may be integrated with a GPU (graphics processing unit) which is responsible for rendering and drawing images that need to be displayed on the display screen. In some embodiments, theprocessor 21 may include an AI (artificial intelligence) processor for processing a calculation operation related to machine learning.
Memory 22 may include one or more computer-readable storage media, which may be non-transitory. Memory 22 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 22 is at least used for storing the following computer program 221, wherein after being loaded and executed by theprocessor 21, the steps of the carousel graph displaying method disclosed in any one of the foregoing embodiments can be implemented.
In some embodiments, theelectronic device 20 may further include a display 23, an input/output interface 24, acommunication interface 25, a sensor 26, a power supply 27, and a communication bus 28.
Those skilled in the art will appreciate that the configuration shown in FIG. 5 is not limiting ofelectronic device 20 and may include more or fewer components than those shown.
Further, an embodiment of the present application also discloses a computer-readable storage medium for storing a computer program, where the computer program is executed by a processor to implement the carousel map display method disclosed in any of the foregoing embodiments.
The specific process of the carousel map display method may refer to corresponding content disclosed in the foregoing embodiments, and is not described herein again.
In the present specification, the embodiments are described in a progressive manner, and each embodiment focuses on differences from other embodiments, and the same or similar parts between the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further 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 other 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 phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
The carousel map display method, apparatus, device and medium provided by the present application are described in detail above, and specific examples are applied in the present application to explain the principles and embodiments of the present application, and the description of the above embodiments is only used to help understand the method and core ideas of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, the specific implementation manner and the application scope may be changed, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (9)

1. A carousel graph display method is characterized by comprising the following steps:
initializing resources to be displayed in a carousel graph, and rendering a sliding device which takes a ScrollView component as a parent container, wherein the resources to be displayed comprise pictures to be displayed and page numbers of the pictures to be displayed;
rendering a sub-picture sequence for the ScrollView component, rendering a sibling container View of the ScrollView component, and taking the sibling container View as a small circle point sequence and a carrier of the page number, wherein the sub-picture sequence is obtained by arranging the pictures to be displayed according to the sequence of the page number, the width of each frame of picture in the sub-picture sequence is the width of an actual display area, the width of the actual display area is determined based on the width of a current device display interface and the outer edge distance of the current device display interface, and the small circle point sequence is used for representing the position of the current display picture in the sub-picture sequence;
mounting the ScrollView component, starting a timer, and moving the picture in the sub-picture sequence by the width of the actual display area along a preset direction if a sliding instruction triggered by a user dragging behavior is not detected every time the timer reaches a preset time so as to sequentially display the pictures to be displayed in the sub-picture sequence in a carousel manner;
the sliding device for rendering the parent container by using the ScrollView component comprises:
setting a preset value as a handle of the ScrollView component;
and acquiring the handle, and setting the attribute of the ScrollView component.
2. A carousel view presentation method according to claim 1, wherein the setting of the attribute of the scrillview component comprises:
setting a horizontal attribute of the ScrollView component as a carousel graph to slide transversely;
setting the property of the showsHorizontalScrollindicator of the ScrollView component as a scroll bar not to be displayed;
setting the pageEnabled attribute of the ScrollView component to be stopped at the position of integral multiple of the size of the scroll view by the scroll bar;
and setting an onMomentumScrollEnd attribute, an onScrollBeginDrag attribute and an onScrollEndDrag attribute for the ScrollView component.
3. The carousel map displaying method according to claim 1, wherein after moving the pictures in the sub-picture sequence by the width of the actual display area along a preset direction, the method further comprises:
updating the small dot sequence according to the page number of the current display picture;
and updating the page number of the current display picture to the state machine.
4. A carousel map displaying method according to claim 1, further comprising:
if a sliding instruction triggered by the user dragging behavior is detected, clearing the timer, and sliding to a target to-be-displayed picture in the sub-picture sequence according to the sliding instruction so as to take the target to-be-displayed picture as a current display picture;
updating the small dot sequence according to the page number of the current display picture and updating the page number of the current display picture to a state machine when the picture to be displayed is slid by one frame;
and when the user dragging behavior is finished, restarting the timer so as to enable the picture to be displayed in the sub-picture sequence to be displayed in an automatic carousel mode.
5. The carousel map displaying method according to any one of claims 1 to 4, wherein the rendering the sequence of sub-pictures for the ScrollView component comprises:
rendering a sub-picture sequence for the ScrollView component;
and setting the width of each frame of picture in the sub-picture sequence as the width of an actual display area.
6. The carousel image displaying method according to claim 5, wherein before setting the width of each frame of picture in the sub-picture sequence to be the width of an actual display area, the method further comprises:
determining the sum of the outer distances of the current equipment display interface;
and taking the difference value of the width of the display interface of the current equipment and the sum of the outer margins as the width of the actual display area.
7. A carousel picture display device, comprising:
the device comprises an initialization module and a display module, wherein the initialization module is used for initializing resources to be displayed in a carousel image and rendering a sliding device which takes a ScrollView component as a parent container, and the resources to be displayed comprise pictures to be displayed and page numbers of the pictures to be displayed; the sliding device for rendering the parent container by using the ScrollView component comprises: setting a preset value as a handle of the ScrollView component; acquiring the handle, and setting the attribute of the ScrollView component;
a rendering module, configured to render a sub-picture sequence for the ScrollView component, render a sibling container View of the ScrollView component, and use the sibling container View as a carrier of a small dot sequence and the page number, where the sub-picture sequence is obtained by arranging the pictures to be displayed according to a sequence of the page number, a width of each frame of the picture in the sub-picture sequence is a width of an actual display area, the width of the actual display area is determined based on a width of a display interface of a current device and an outer edge distance of the display interface of the current device, and the small dot sequence is used to represent a position of the current display picture in the sub-picture sequence;
and the carousel module is used for mounting the ScrollView component and starting a timer, and when the timer reaches preset time each time, if a sliding instruction triggered by a user dragging behavior is not detected, moving the pictures in the sub-picture sequence by the width of the actual display area along a preset direction so as to sequentially display the pictures to be displayed in the sub-picture sequence in a carousel manner.
8. An electronic device, comprising:
a memory and a processor;
wherein the memory is used for storing a computer program;
the processor is configured to execute the computer program to implement the carousel map display method according to any one of claims 1 to 6.
9. A computer-readable storage medium for storing a computer program, wherein the computer program is configured to implement the carousel map presentation method according to any one of claims 1 to 6 when executed by a processor.
CN202110113684.6A2021-01-272021-01-27Carousel graph display method, device, equipment and mediumActiveCN112835499B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202110113684.6ACN112835499B (en)2021-01-272021-01-27Carousel graph display method, device, equipment and medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202110113684.6ACN112835499B (en)2021-01-272021-01-27Carousel graph display method, device, equipment and medium

Publications (2)

Publication NumberPublication Date
CN112835499A CN112835499A (en)2021-05-25
CN112835499Btrue CN112835499B (en)2022-12-09

Family

ID=75932204

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202110113684.6AActiveCN112835499B (en)2021-01-272021-01-27Carousel graph display method, device, equipment and medium

Country Status (1)

CountryLink
CN (1)CN112835499B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN115497080A (en)*2021-06-182022-12-20广州视源电子科技股份有限公司Carousel control method and device, computer readable storage medium and processor
CN113360692A (en)*2021-06-222021-09-07上海哔哩哔哩科技有限公司Display method and system of carousel view
CN113791751B (en)*2021-09-272024-05-03腾讯科技(深圳)有限公司Method and system for displaying carousel graphs, storage medium and terminal equipment
CN114371902A (en)*2022-01-112022-04-19平安消费金融有限公司 Carousel picture display method, device, computer equipment and storage medium
CN114943005A (en)*2022-05-182022-08-26中国建设银行股份有限公司Picture display processing method and device
CN115328365A (en)*2022-08-092022-11-11北京达佳互联信息技术有限公司 Carousel component rendering method, device, electronic device and storage medium
CN116628374A (en)*2023-07-192023-08-22共道网络科技有限公司Display method and device of browser interface, electronic equipment and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111694499A (en)*2020-05-272020-09-22北京城市网邻信息技术有限公司Carousel picture display method and carousel picture display device

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20120010995A1 (en)*2008-10-232012-01-12Savnor TechnologiesWeb content capturing, packaging, distribution
US20110145757A1 (en)*2009-12-012011-06-16Fida JanwariScrolling Control and Communication Control Applications and Methods
US20140258894A1 (en)*2013-03-052014-09-11Research In Motion LimitedVisual Timeline Of An Application History
US11137889B2 (en)*2018-02-282021-10-05Microsoft Technology Licensing, LlcAdaptive interface transformation across display screens
CN110929190A (en)*2019-09-232020-03-27平安科技(深圳)有限公司Page playing method and device, electronic equipment and storage medium
CN111158840B (en)*2019-12-312023-04-28中国银行股份有限公司Image carousel method and device
CN111209422A (en)*2019-12-312020-05-29广州华多网络科技有限公司 Image display method, device, electronic device, and storage medium
CN111966274A (en)*2020-08-272020-11-20广东巴金斯科技有限公司WeChat applet picture preview processing method, device, equipment and storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111694499A (en)*2020-05-272020-09-22北京城市网邻信息技术有限公司Carousel picture display method and carousel picture display device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
QuintGao.GKCycleScrollView - 一个轻量级的自定义轮播图组件.《https://www.jianshu.com/p/950ca713e6a9》.2019,第1-8页.*
耳_总.ReactNative banner轮播控件的实现.《https://www.jianshu.com/p/bb7beeb66fd5》.2017,第1-5页.*

Also Published As

Publication numberPublication date
CN112835499A (en)2021-05-25

Similar Documents

PublicationPublication DateTitle
CN112835499B (en)Carousel graph display method, device, equipment and medium
CN108476306B (en) An image display method and terminal device
CN104615336B (en)A kind of information processing method and electronic equipment
US9501215B2 (en)Image display device, image display control method, program and information storage medium
CN111190672A (en) UI interface adaptation method of electronic device, electronic device and storage medium
CN106777380A (en) Browser page display method, device and terminal
US10643580B2 (en)Method and device for switching playing mode of a mobile terminal, storage medium and program
CN111476852B (en)Reader refresh method, computing device, and computer storage medium
CN110187816B (en)Automatic page turning method for cartoon type electronic book, computing device and storage medium
CN103336787B (en)A kind of method and apparatus for scaling webpage
WO2022194211A1 (en)Image processing method and apparatus, electronic device and readable storage medium
EP3043251A1 (en)Method of displaying content and electronic device implementing same
WO2016192546A1 (en)Method and device for updating data point of dynamic curve
CN109992188B (en)Method and device for realizing scrolling display of iOS mobile terminal text
US20160093079A1 (en)Enhanced document readability on devices
WO2016073805A2 (en)Enhanced view transitions
CN111477183B (en)Reader refresh method, computing device, and computer storage medium
CN111401165A (en)Station caption extraction method, display device and computer-readable storage medium
WO2017113737A1 (en)Method of displaying animated images, and device and terminal equipment
WO2017011680A1 (en)Device and method for processing data
EP4300979A1 (en)Display method, terminal, and storage medium
CN106488314B (en)A kind of barrage rendering method
CN113703653A (en)Image processing method, device, equipment and computer readable storage medium
CN114625997A (en)Page rendering method and device, electronic equipment and computer readable medium
CN107688636B (en)Page adaptation method and device

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp