Tab column focus centering display method, system and device and medium
By monitoring the focus status of the Tab column in real time and adjusting its display position dynamically, the cumbersome operation problem caused by the increase in the number of Tab columns is solved, and the effect of always centering the focus of the Tab column is achieved, improving the user experience and interface aesthetics.
Patent Information
- Application Number
- CN202411175909.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-11-29
AI Technical Summary
As the number of Tab columns increases, users need to scroll frequently to locate the required functional portal, which leads to cumbersome, time-consuming and increased cognitive burden, especially when the target Tab is located at the edge of the screen, further reducing the user experience.
By monitoring the focus status of the Tab column in real time, calculate the offset of the target Tab from the center of the screen, dynamically adjust its display position, and add a smooth animation effect so that the tab that obtains the focus is always located in the center of the screen.
It simplifies user operations, improves interface friendliness and operation efficiency, improves the Tab bar usage experience, avoids visual discomfort caused by the Tab position deviating from the center, and ensures smooth operation of the application.
Smart Images

Figure CN119045704A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of interface display, and more particularly to a method, system, device and medium for displaying a Tab column focus in the center. Background Art
[0002] With the rapid development of science and technology, intelligent terminal devices such as smart phones, tablet computers and laptops have become indispensable tools in people's daily life and work. The user interface design on these devices is directly related to the quality of user experience. Among them, the Tab column, as an important navigation element, is widely used in various applications to display a variety of pages or function entrances, which greatly facilitates user operation and browsing.
[0003] However, in current interface design practice, when the number of tab columns exceeds the width of the screen, the traditional approach is to allow users to scroll the tab bar horizontally or vertically to access all tabs through a scroll bar. This design approach was barely acceptable when the number of tabs was small, but as application functions continue to become richer and more complex, the number of tab columns has increased significantly, causing users to frequently scroll the tab bar to locate the desired function entry. This operation is not only cumbersome and time-consuming, reducing user operating efficiency, but may also cause users to lose their way during the scrolling process, increasing cognitive burden.
[0004] What is more serious is that when the target Tab is located at the edge of the screen and the user finds and selects it by scrolling, due to the deviation of the visual focus from the center of the screen, the user often needs to adjust the line of sight or scroll the screen again to view the page content corresponding to the Tab, which further aggravates the inconvenience of operation and the decline of user experience. Summary of the invention
[0005] In view of the above problems, the purpose of the present invention is to provide a method, system, device and medium for displaying the focus of a Tab column in the center, which automatically adjusts the display position of the Tab column so that the Tab with focus is always located in the center of the screen, thereby simplifying user operations and improving interface friendliness and operating efficiency.
[0006] In order to achieve the above object, the present invention is implemented through the following technical solutions:
[0007] In a first aspect, the present invention discloses a method for displaying a tab column with a focus centered, comprising:
[0008] Monitor the focus status of each Tab in the Tab column in real time. When any Tab is selected or gains focus, the Tab is used as the target Tab and the location information of the target Tab in the current screen is determined.
[0009] Identify the current screen width, the total width of the Tab column, and the width of each Tab, and calculate the horizontal offset of the target Tab from the center of the current screen based on the position information of the target Tab in the current screen;
[0010] Dynamically adjust the display position of the target Tab according to the horizontal offset;
[0011] Add a smooth animation effect when adjusting the display position of the target Tab.
[0012] Furthermore, the real-time monitoring of the focus state of each Tab in the Tab column, when any Tab is selected or gains focus, the Tab is used as the target Tab, including:
[0013] Register event listeners in the UI framework of the terminal device;
[0014] Use event listeners to monitor user click or touch events in real time;
[0015] When a user clicks or touches a tab in the Tab column, the tab is marked as the target tab.
[0016] Further, the determining the location information of the target Tab in the current screen includes:
[0017] Use the screenshot tool to capture the screen area containing the row where the target Tab is located, and crop the row image through image processing technology;
[0018] In the cropped row image, all Tab elements are found through machine learning recognition technology and sorted based on their horizontal positions to determine the sequence number f of the target Tab.
[0019] Further, the identifying the current screen width, the total width of the Tab column and the width of each Tab, and calculating the horizontal offset of the target Tab from the center of the current screen based on the position information of the target Tab in the current screen, includes:
[0020] Get the current screen width Ws, the total width Wt of the Tab column, and the width W of each Tab through the getWidth method provided by the native API;
[0021] The blank width on both sides of the Tab column is calculated by the formula P=1 / 2(Ws-Wt);
[0022] Use the offset calculation formula to calculate the horizontal offset of the target Tab from the center of the current screen.
[0023] Furthermore, the lateral offset calculation formula is as follows:
[0024]
[0025] Among them, S is the width of the interval between Tabs, and O is the horizontal offset of the target Tab from the center of the current screen.
[0026] Further, dynamically adjusting the display position of the target Tab according to the lateral offset includes: when the lateral offset is a positive number, the moving direction is left, and the moving distance is the absolute value of the lateral offset; when the lateral offset is a negative number, the moving direction is right, and the moving distance is the absolute value of the lateral offset; and moving the target Tab to the center of the screen through a scrolling operation according to the moving direction and the moving distance.
[0027] Furthermore, the adding of a smooth animation effect during the adjustment of the display position of the target Tab includes: using the TranslateAnimation class to add a smooth animation effect during the adjustment of the Tab column position by setting the coordinate values of the target Tab start position and the end fingerprint.
[0028] In a second aspect, the present invention further discloses a Tab column focus centering display system, comprising:
[0029] The focus detection module is used to monitor the focus status of each Tab in the Tab column in real time. When any Tab is selected or gains focus, the Tab is used as the target Tab and the position information of the target Tab in the current screen is determined. The position calculation module is used to identify the current screen width, the total width of the Tab column and the width of each Tab, and calculate the horizontal offset of the target Tab from the center of the current screen based on the position information of the target Tab in the current screen.
[0030] A dynamic adjustment module, used to dynamically adjust the display position of the target Tab according to the lateral offset;
[0031] The effect module is used to add a smooth animation effect during the display position adjustment process of the target Tab.
[0032] In a third aspect, the present invention further discloses a Tab column focus centering display device, comprising:
[0033] The memory is used to store the Tab column focus center display program;
[0034] A processor is used to implement the steps of the Tab column focus centering display method as described in any one of the above items when executing the Tab column focus centering display program.
[0035] In a fourth aspect, the present invention further discloses a readable storage medium, on which is stored a Tab column focus centering display program, which, when executed by a processor, implements the steps of the Tab column focus centering display method as described in any of the above items.
[0036] Compared with the prior art, the present invention has the following beneficial effects:
[0037] 1. The present invention monitors the focus state of the Tab column in real time, dynamically adjusts the selected Tab to the center of the screen, and combines it with a smooth animation effect, so that the user can immediately obtain clear visual feedback no matter which Tab is clicked, thereby greatly improving the user experience and operation fluency when using the Tab bar.
[0038] 2. The present invention accurately calculates the lateral offset between the target Tab and the center of the screen and adjusts the Tab position accordingly to ensure that each Tab is displayed in the center when selected. This not only makes the interface layout more balanced and beautiful, but also avoids the visual discomfort caused by the Tab position being off-center, further enhancing the overall aesthetics of the interface.
[0039] 3. The present invention uses efficient algorithms and native APIs to obtain screen and Tab related parameters, and combines machine learning recognition technology to quickly locate the target Tab, ensuring rapid response to focus adjustment operations. At the same time, by introducing smooth animation effects, the fun of user interaction is enhanced without causing a significant burden on the performance of the application, ensuring smooth operation and efficient performance of the application.
[0040] It can be seen that compared with the prior art, the present invention has outstanding substantive features and significant progress, and the beneficial effects of its implementation are also obvious. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0042] Figure 1 It is a method flow chart of a specific implementation mode of the present invention.
[0043] Figure 2 It is a system structure diagram of a specific implementation mode of the present invention.
[0044] In the figure, 1. focus detection module; 2. position calculation module; 3. dynamic adjustment module; 4. effect module. DETAILED DESCRIPTION
[0045] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0046] See also Figure 1 As shown, this embodiment provides a method for displaying a Tab column with the focus centered, comprising the following steps:
[0047] S1: monitor the focus status of each Tab in the Tab column in real time. When any Tab is selected or gains focus, the Tab is used as the target Tab, and the position information of the target Tab in the current screen is determined.
[0048] In a specific implementation, an event listener is first registered in the UI framework of the terminal device; then the event listener is used to monitor the user's click or touch events in real time; when the user's click or touch event occurs on any Tab in the Tab column, the Tab is marked as the target Tab.
[0049] At this point, use a screenshot tool (such as Python's pyautogui) to capture the screen area containing the row where the target Tab is located, and crop the row image through image processing technology (such as OpenCV); in the cropped row image, find all Tab elements through machine learning recognition technology, and sort them based on their horizontal positions (such as the x-coordinate of the bounding box) to determine the sequence number f of the target Tab, thereby determining that the target Tab is the f-th Tab in the row.
[0050] As an example, RecylerView is used to display the Tab list, and RecyclerView's own item listener is used to determine the focus selected state and unselected state of the Tab.
[0051] S2: Identify the current screen width, the total width of the Tab column, and the width of each Tab, and calculate the horizontal offset of the target Tab from the center of the current screen based on the position information of the target Tab in the current screen.
[0052] In a specific implementation, first, the current screen width Ws, the total width Wt of the Tab column, and the width W of each Tab are obtained through the getWidth method provided by the native API; then, the blank width on both sides of the Tab column is calculated through the formula P=1 / 2(Ws-Wt); finally, the horizontal offset of the target Tab from the center of the current screen is calculated using the offset calculation formula.
[0053] In this step, the displacement calculation formula is as follows:
[0054]
[0055] Among them, S is the width of the interval between Tabs, and O is the horizontal offset of the target Tab from the center of the current screen.
[0056] As an example, based on the current screen width, the total width of the Tab column, and the width of each Tab, these widths can be obtained through the getWidth method provided by the native API. Then calculate the horizontal offset required if the Tab with focus is adjusted to the center of the screen. This calculation process needs to consider factors such as the spacing between Tabs and the margins to ensure the beauty of the interface and smooth operation.
[0057] Specifically, the information (width, height) of each tab obtained by the methods (getWidth, getHeight) provided by the native API is stored in an appropriate data structure for subsequent use. The currently focused tab tab is determined based on the user's operation (such as click, slide, etc.). The offset between the currently focused tab and the center position of the Tab column is calculated.
[0058] The formula for calculating the offset is: width of Tab1 + spacing + width of Tab2 + spacing + ... + width of the previous Tab of the Tab with focus + blank space on both sides + half the width of the Tab with focus - half the width of the screen.
[0059] S3: dynamically adjusting the display position of the target Tab according to the lateral offset.
[0060] In a specific implementation, when the horizontal offset is a positive number, the moving direction is left, and the moving distance is the absolute value of the horizontal offset; when the horizontal offset is a negative number, the moving direction is right, and the moving distance is the absolute value of the horizontal offset. At this time, according to the moving direction and the moving distance, the target Tab is moved to the center of the screen through a scrolling operation.
[0061] As an example, dynamically adjust the display position of the Tab column according to the calculated horizontal offset. If the Tab that has gained focus is not in the center of the screen, scroll or translate the Tab column to make it centered. At the same time, keep other Tabs that have not gained focus visible on the screen so that users can switch at any time. If the Tab bar supports scrolling, move the focused tab to the center by scrolling. This can be achieved by setting the scroll position of the scroll view. If scrolling is not supported or the scrolling effect is poor, you can try to indirectly achieve focus centering by adjusting the spacing between Tab labels.
[0062] S4: Add a smooth animation effect during the display position adjustment process of the target Tab.
[0063] In the specific real-time mode, the TranslateAnimation class is used to add a smooth animation effect in the process of adjusting the position of the Tab column by setting the coordinate values of the target Tab start position and the end fingerprint.
[0064] As an example, the Tab position is smoothly adjusted through the displacement animation provided by the native API, and the TranslateAnimation class is used for the following settings:
[0065] TranslateAnimation translateAnimation = new TranslateAnimation (starting point position of x coordinate, ending point position of x coordinate, starting point position of y coordinate, ending point position of y coordinate), thereby realizing the implantation of smooth animation effect.
[0066] In addition, in this method, the layout and display mode of the Tab column are automatically adjusted according to the screen size and resolution of the terminal device to adapt to the display requirements of different devices.
[0067] The present invention provides a method for displaying the focus of a Tab column in the center, which monitors the focus state of the Tab column in real time and dynamically adjusts the selected Tab to the center of the screen, combined with a smooth animation effect, so that the user can immediately obtain clear visual feedback no matter which Tab is clicked, thereby greatly improving the user experience and operation fluency when using the Tab bar.
[0068] See also Figure 2 As shown, the present invention also discloses a Tab column focus centering display system, comprising: a focus detection module 1, a position calculation module 2, a dynamic adjustment module 3 and an effect module 4.
[0069] The focus detection module 1 is used to monitor the focus status of each Tab in the Tab column in real time. When any Tab is selected or gains focus, the Tab is used as the target Tab and the position information of the target Tab in the current screen is determined.
[0070] Position calculation module 2 is used to identify the current screen width, the total width of the Tab column and the width of each Tab, and calculate the horizontal offset of the target Tab from the center of the current screen based on the position information of the target Tab in the current screen.
[0071] A dynamic adjustment module 3, used to dynamically adjust the display position of the target Tab according to the lateral offset;
[0072] Effect module 4 is used to add a smooth animation effect during the display position adjustment process of the target Tab.
[0073] The specific implementation of the Tab column focus centering display system of this embodiment is basically the same as the specific implementation of the Tab column focus centering display method described above, and will not be repeated here.
[0074] The present invention also discloses a Tab column focus centering display device, comprising a processor and a memory; wherein the processor implements the steps of the Tab column focus centering display method as described in any one of the above items when executing the Tab column focus centering display program stored in the memory.
[0075] Furthermore, the Tab column focus centering display device in this embodiment may also include:
[0076] The input interface is used to obtain the Tab column focus centering display program imported from the outside, and save the obtained Tab column focus centering display program to the memory, and can also be used to obtain various instructions and parameters transmitted by the external terminal device, and transmit them to the processor, so that the processor can use the above various instructions and parameters to carry out corresponding processing. In this embodiment, the input interface can specifically include but is not limited to a USB interface, a serial interface, a voice input interface, a fingerprint input interface, a hard disk reading interface, etc.
[0077] The output interface is used to output various data generated by the processor to the terminal device connected thereto, so that other terminal devices connected to the output interface can obtain various data generated by the processor. In this embodiment, the output interface may specifically include but is not limited to a USB interface, a serial interface, etc.
[0078] The communication unit is used to establish a remote communication connection between the Tab column focus center display device and the external server so that the Tab column focus center display device can mount the image file to the external server. In this embodiment, the communication unit may specifically include but is not limited to a remote communication unit based on wireless communication technology or wired communication technology.
[0079] The keyboard is used to obtain various parameter data or instructions input by the user by tapping the keycaps in real time.
[0080] The display is used to display the relevant information of the Tab column focus center display process in real time.
[0081] The mouse can be used to assist users in inputting data and simplify user operations.
[0082] The present invention also discloses a readable storage medium, wherein the readable storage medium includes a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable hard disk, a CD-ROM or any other form of storage medium known in the technical field. The readable storage medium stores a Tab column focus centering display program, and when the Tab column focus centering display program is executed by a processor, the steps of the Tab column focus centering display method described in any one of the above items are implemented.
[0083] In summary, the present invention automatically adjusts the display position of the Tab column so that the Tab with focus is always located at the center of the screen, thereby simplifying user operations and improving interface friendliness and operating efficiency.
[0084] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. As for the method disclosed in the embodiment, since it corresponds to the system disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0085] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0086] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.
[0087] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0088] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each module may exist physically separately, or two or more modules may be integrated into one unit.
[0089] Similarly, each processing unit in each embodiment of the present invention may be integrated into one functional module, or each processing unit may exist physically, or two or more processing units may be integrated into one functional module.
[0090] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0091] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0092] The above is a detailed introduction to the Tab column focus centering display method, system, device and readable storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A method for displaying a tab column with a centered focus, characterized in that: include: Monitor the focus status of each Tab in the Tab column in real time. When any Tab is selected or gains focus, the Tab is used as the target Tab and the location information of the target Tab in the current screen is determined. Identify the current screen width, the total width of the Tab column, and the width of each Tab, and calculate the horizontal offset of the target Tab from the center of the current screen based on the position information of the target Tab in the current screen; Dynamically adjust the display position of the target Tab according to the horizontal offset; Add a smooth animation effect when adjusting the display position of the target Tab.
2. The method for displaying the Tab column focus in the center according to claim 1, characterized in that: The real-time monitoring of the focus status of each Tab in the Tab column, when any Tab is selected or gains focus, the Tab is used as the target Tab, including: Register event listeners in the UI framework of the terminal device; Use event listeners to monitor user click or touch events in real time; When a user clicks or touches a tab in the Tab column, the tab is marked as the target tab.
3. The method for displaying the Tab column focus in the center according to claim 2, characterized in that: The determining the location information of the target Tab in the current screen includes: Use the screenshot tool to capture the screen area containing the row where the target Tab is located, and crop the row image through image processing technology; In the cropped row image, all Tab elements are found through machine learning recognition technology and sorted based on their horizontal positions to determine the sequence number f of the target Tab.
4. The method for displaying the Tab column focus in the center according to claim 3, characterized in that: The identifying the current screen width, the total width of the Tab column and the width of each Tab, and calculating the horizontal offset of the target Tab from the center of the current screen based on the position information of the target Tab in the current screen, includes: obtaining the current screen width Ws, the total width Wt of the Tab column and the width W of each Tab through the getWidth method provided by the native API; The blank width on both sides of the Tab column is calculated by the formula P=1 / 2(Ws-Wt); Use the offset calculation formula to calculate the horizontal offset of the target Tab from the center of the current screen.
5. The method for displaying the Tab column focus in the center according to claim 4, characterized in that: The calculation formula of the lateral offset is as follows: Among them, S is the width of the interval between Tabs, and O is the horizontal offset of the target Tab from the center of the current screen.
6. The method for displaying the Tab column focus in the center according to claim 5, characterized in that: The dynamically adjusting the display position of the target Tab according to the horizontal offset includes: When the lateral offset is a positive number, the moving direction is left and the moving distance is the absolute value of the lateral offset; When the lateral offset is a negative number, the moving direction is right and the moving distance is the absolute value of the lateral offset; According to the moving direction and moving distance, the target Tab is moved to the center of the screen through a scrolling operation.
7. The method for displaying the Tab column in the center of focus according to claim 6, characterized in that: The step of adding a smooth animation effect during the process of adjusting the display position of the target Tab includes: The TranslateAnimation class is used to set the coordinate values of the target Tab start position and the end fingerprint, and a smooth animation effect is added during the Tab column position adjustment process.
8. A Tab column focus centering display system, characterized in that: include: The focus detection module is used to monitor the focus status of each Tab in the Tab column in real time. When any Tab is selected or gains focus, the Tab is used as the target Tab and the position information of the target Tab in the current screen is determined; The position calculation module is used to identify the current screen width, the total width of the Tab column and the width of each Tab, and calculate the horizontal offset of the target Tab from the center of the current screen based on the position information of the target Tab in the current screen; A dynamic adjustment module, used to dynamically adjust the display position of the target Tab according to the lateral offset; The effect module is used to add a smooth animation effect during the display position adjustment process of the target Tab.
9. A Tab column focus centering display device, characterized in that: include: The memory is used to store the Tab column focus center display program; A processor is used to implement the steps of the Tab column focus centering display method as described in any one of claims 1 to 7 when executing the Tab column focus centering display program.
10. A readable storage medium, characterized in that: The readable storage medium stores a Tab column focus centering display program, and when the Tab column focus centering display program is executed by a processor, the steps of the Tab column focus centering display method according to any one of claims 1 to 7 are implemented.
