Page multi-screen adaptation method and device, vehicle, storage medium and program product
By detecting display screen switching and dynamically adapting page elements, the problem of insufficient page adaptation flexibility in the prior art is solved, and dynamic page adaptation and content consistency during screen switching is achieved.
Patent Information
- Application Number
- CN202411923529.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-25
AI Technical Summary
When an existing page adaptation method switches between screens when an application fails to dynamically adjust the page layout, resulting in poor flexibility.
By detecting the display screen switching, obtain the resolution information of the target display screen, and split the active page into active pages, page fragments, loop view and entry view by hierarchy. Use matching layout folders and configuration files to independently adapt page elements at each level to complete the dynamic adaptation of the entire active page.
Dynamic page adaptation during screen switching is realized, improving flexibility and user experience, and ensuring consistency of page content on different screens.
Smart Images

Figure CN119883465A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of page adaptation, and in particular to a method, device, vehicle, storage medium and program product for multi-screen page adaptation. Background Art
[0002] With the development of smart cockpit technology, there are more and more screens in the car cockpit. Screens are set up in the driver's seat, the co-pilot seat and the back seat, which not only facilitates the driver's driving but also provides other passengers with a better user experience. Due to the space and position in the cockpit, the size and resolution of these screens are different. When an application needs to be displayed on each screen, the application interface needs to be adapted to ensure that the application displays the same or similar effects on screens with different resolutions, and when the application switches between screens according to user needs, its display content and status on the previous screen must be maintained.
[0003] At present, dynamically setting layout parameters in the code is a common means of page adaptation. It dynamically adjusts the layout according to the operating conditions, but the code has low readability and maintainability, which easily increases the development cost; the adaptation of layout files is a method of page adaptation in Android development, which can meet the user's page display in different scenarios, help reduce duplicate code, and improve development efficiency, but it is difficult to achieve compatibility with multiple screens with different resolutions; layout resolution adaptation provides layout resources based on static screen width information, and cannot dynamically adjust the layout according to the real-time status of the device such as screen switching, and has poor flexibility. Summary of the invention
[0004] In view of this, the present invention provides a page multi-screen adaptation method, device, vehicle, storage medium and program product to solve the problem that the existing page adaptation method cannot dynamically adjust the page layout as the screen switches when the application switches between screens, and has poor flexibility.
[0005] In a first aspect, the present invention provides a method for multi-screen adaptation of a page, the method comprising:
[0006] If it is detected that the display screen for displaying the active page is switched to the target display screen, the resolution information of the target display screen and the page elements constituting the active page are obtained, and the page elements are hierarchically divided from top to bottom into the active page, page fragments, loop views and item views, and the page elements of the lower layer are located in the page elements of the upper layer;
[0007] Determine a layout folder and configuration file that matches the resolution information, and use the layout folder and configuration file to adapt the page elements one by one from top to bottom according to the hierarchy to obtain the adapted page elements;
[0008] The adapted page elements are loaded so that the target display screen displays the adapted active page.
[0009] Beneficial effect: After detecting that the display screen has switched, the present invention obtains a layout file and a configuration file that match the resolution of the target display screen, and then splits the active page into active pages, page fragments, circular views, and entry views by level, and uses the layout file and the configuration file to independently adapt the page elements of each level one by one, thereby completing the dynamic adaptation of the entire active page when the screen switches, and the layered adaptation is conducive to differentiated processing and has greater flexibility.
[0010] In an optional implementation, the layout folder and the configuration file are used to adapt the page elements one by one from top to bottom in the hierarchy to obtain the adapted page elements, including:
[0011] According to the layout folder, an activity page layout file, a page fragment layout file and an item view layout file matching the resolution information of the target display screen are obtained;
[0012] Adapting the active page based on the active page layout file to obtain an adapted active page, and adapting the page fragments based on the page fragment layout file to obtain adapted page fragments;
[0013] The cyclic view and the item views in the cyclic view are adapted according to the configuration file and the item view layout file to obtain the adapted cyclic view and the adapted item views.
[0014] Beneficial effect: The present invention reasonably uses different adaptation methods to independently adapt page elements at each level, completes the full adaptation of the active page, page fragments, cyclic views and item views located in the cyclic views, thereby completing the overall adaptation of the active page content, making the adaptation work organized, and facilitating subsequent development and maintenance work, thereby improving development efficiency and maintainability.
[0015] In an optional implementation, adapting the cyclic view and the item views in the cyclic view according to the configuration file and the item view layout file to obtain the adapted cyclic view and the adapted item views includes:
[0016] Determine a first width and a first height of the cyclic view, and obtain first attribute information of the cyclic view according to the configuration file; wherein the first attribute information includes at least some of the following items: inner spacing, number of entry rows, number of entry columns, entry row spacing, entry column spacing, and parent cyclic view;
[0017] Adapting the cyclic view according to the first width, the first height and the first attribute information to obtain an adapted cyclic view, and calculating a second width and a second height of the item view in the cyclic view according to the first width, the first height and the first attribute information;
[0018] The item views in the cyclic view are adapted according to the second width, the second height and the item view layout file to obtain an adapted item view.
[0019] Beneficial effects: The present invention uses the attribute information recorded in the configuration file of the cyclic view to determine the width and height of the item views in the cyclic view, and uses the characteristics of the system components to combine and adapt the cyclic view and the item views in the cyclic view as the most basic adaptation units, thereby simplifying the adaptation work.
[0020] In an optional implementation, adapting the item view in the cyclic view according to the second width, the second height, and the item view layout file to obtain the adapted item view includes:
[0021] The size of the entry view is adjusted according to the second width and the second height, and the layout of the entry view is adjusted according to the entry view layout file to obtain an adapted entry view.
[0022] Beneficial effect: The present invention uses the calculated second width and second height to adjust the size of the entry view to achieve size adaptation of the entry view, and adapts the content of the entry view according to the entry view layout file to achieve adaptive adaptation of the entry view in the target display screen with high flexibility.
[0023] In an optional implementation, calculating the second width and the second height of the item view in the cyclic view according to the first width, the first height and the first attribute information includes:
[0024] The overall width of the item view is calculated according to the first width, the left row spacing and the right row spacing in the inner spacing, the number of item columns, and the item column spacing; and the second width of the item view is calculated according to the ratio between the overall width of the item view and the number of item columns;
[0025] The overall height of the item view is calculated according to the first height, the top spacing and the bottom spacing in the inner spacing, the number of item rows and the item row spacing; and the second height of the item view is calculated according to the ratio between the overall height of the item view and the number of item rows.
[0026] Beneficial effect: The present invention calculates the second width and the second height of the item view according to the first attribute information of the loop view in the configuration file, and then uses the second width and the second height to adjust the size of the item view, thereby achieving size adaptation of the item view.
[0027] In an optional implementation, adapting the activity page based on the activity page layout file to obtain the adapted activity page includes:
[0028] According to the active page layout file, a first size parameter of the active page and first layout information of page elements in the active page are configured to obtain an adapted active page.
[0029] Beneficial effect: The present invention sets the size parameters of the active page through the active page layout file to achieve size adaptation of the active page, and sets the layout information of the page elements in the active page to adapt the content of the active page so that the overall size and layout of the active page match the resolution of the target display screen, thereby improving the user's visual experience when switching application display screens.
[0030] In an optional implementation, adapting the page fragments based on the page fragment layout file to obtain the adapted page fragments includes:
[0031] According to the page fragment layout file, second size parameters of each page fragment located in the active page and second layout information of the page elements in the page fragment are configured to obtain adapted page fragments.
[0032] Beneficial effect: The present invention sets the size parameters of page fragments through a page fragment layout file to achieve size adaptation of page fragments in an active page, sets layout information of each page element in the page fragments, and adapts the display content of the page fragments to make the size layout of the page fragments in the active page match the resolution of the target display screen, thereby improving the user's visual experience when switching application display screens.
[0033] In an optional implementation, after detecting that the display screen of the application page is switched, the method further includes:
[0034] Obtain the data status of each page fragment in the application activity page in the current display screen, and save the data status;
[0035] After loading the adapted page element, the method further includes:
[0036] According to the data status, data recovery is performed on each page fragment in the target display screen.
[0037] Beneficial effect: The present invention obtains and saves the previous data status of each page fragment in the active page, and after the screen switches, restores the each page fragment in the target display screen to the previous status, thereby ensuring the consistency of the display content of the active page before and after the screen switches, without the user having to re-operate, thereby improving the user experience.
[0038] In a second aspect, the present invention provides a device for multi-screen adaptation of a page, the device comprising:
[0039] The first processing module is used for obtaining the resolution information of the target display screen and the page elements constituting the active page if it is detected that the display screen of the application active page is switched, wherein the page elements are hierarchically divided into active page, page fragments, loop view and item view from top to bottom, and the page elements of the lower layer are located in the page elements of the upper layer;
[0040] The second processing module is used to determine the layout folder and configuration file that match the resolution information, and use the layout folder and configuration file to adapt the page elements one by one from top to bottom according to the hierarchy to obtain the adapted page elements;
[0041] The third processing module is used to load the adapted page elements so that the target display screen displays the adapted active page.
[0042] In a third aspect, the present invention provides a vehicle, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the page multi-screen adaptation method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0043] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the page multi-screen adaptation method of the first aspect or any corresponding embodiment thereof.
[0044] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, wherein the computer instructions are used to enable a computer to execute the page multi-screen adaptation method of the first aspect or any corresponding embodiment thereof.
[0045] The beneficial effects of the present invention are:
[0046] After detecting that the display screen has switched, the present invention obtains a layout file and a configuration file that match the resolution of the target display screen, and then splits the active page into active pages, page fragments, circular views and entry views by level, and uses the layout file and the configuration file to independently adapt the page elements of each level one by one, thereby completing the dynamic adaptation of the entire active page when the screen switches, and the layered adaptation is conducive to differentiated processing and has greater flexibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0048] Figure 1 is a multi-screen schematic diagram of a smart cockpit according to an embodiment of the present invention;
[0049] Figure 2 is a flow chart of a method for multi-screen adaptation of a page according to an embodiment of the present invention;
[0050] Figure 3 is a schematic diagram of a hierarchical relationship of an activity page according to an embodiment of the present invention;
[0051] Figure 4 is a schematic diagram of the quantitative relationship of page elements according to an embodiment of the present invention;
[0052] Figure 5 is a flowchart of another method for multi-screen adaptation of a page according to an embodiment of the present invention;
[0053] Figure 6 is a schematic diagram of selecting a layout file according to a resolution according to an embodiment of the present invention;
[0054] Figure 7 is a schematic diagram of selecting a configuration file according to a resolution according to an embodiment of the present invention;
[0055] Figure 8 is an entity relationship diagram of a cyclic view configuration file according to an embodiment of the present invention;
[0056] Fig. 9 is a schematic diagram of the quantitative relationship between a cyclic view and a configuration file according to an embodiment of the present invention;
[0057] Fig. 10A is a schematic diagram of a vertical linear layout of cyclic views according to an embodiment of the present invention;
[0058] Fig. 10B is a schematic diagram of a circular view horizontal linear layout according to an embodiment of the present invention;
[0059] Fig. 10C is a schematic diagram of a circular view grid layout according to an embodiment of the present invention;
[0060] Fig. 10D is a schematic diagram of a circular view waterfall layout according to an embodiment of the present invention;
[0061] Fig.11 is a class diagram of cyclic view adaptation according to an embodiment of the present invention;
[0062] Fig.12 is a schematic diagram of marking circular view attribute information according to an embodiment of the present invention;
[0063] Fig.13 is a self-adaptation flow chart when starting an application according to an embodiment of the present invention;
[0064] Fig.14 is a self-adaptation flow chart when switching screens according to an embodiment of the present invention;
[0065] Fig.15A is a schematic diagram of a screen adaptation effect according to an embodiment of the present invention;
[0066] Fig. 15B is a schematic diagram of another screen adaptation effect according to an embodiment of the present invention;
[0067] Fig. 15C is a schematic diagram of another screen adaptation effect according to an embodiment of the present invention;
[0068] Fig.15D is a schematic diagram of another screen adaptation effect according to an embodiment of the present invention;
[0069] Fig.16 is an adaptive adaptation diagram for switching between multiple screens according to an embodiment of the present invention;
[0070] Fig.17 is a structural block diagram of a device for multi-screen adaptation of a page according to an embodiment of the present invention;
[0071] Fig.18 Schematic diagram of the hardware structure of a vehicle according to an embodiment of the present invention. DETAILED DESCRIPTION
[0072] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0073] With the development of smart cockpit technology, there are more and more screens in the cockpit, such as Figure 1As shown, there is an instrument screen and a central control screen on the driver's seat, a co-pilot screen on the co-pilot seat, and a second-row entertainment screen on the back seat, which not only facilitates the driver's driving but also provides a better user experience for other passengers. However, due to the space and position in the cockpit, the sizes and resolutions of these screens are different. When an application needs to be displayed on each screen separately, this involves the issue of application adaptation. It is necessary to ensure that the application displays the same or similar effects on screens with different resolutions according to the visual design, and when the application switches between screens, it must maintain its display content and status on the previous screen.
[0074] Dynamic settings in code (i.e. setting layout parameters programmatically) is a common method for traditional page adaptation. Compared with setting directly in XML layout files, it has some unique advantages: it can dynamically adjust the layout according to runtime conditions, with high flexibility; dynamically creating and destroying views through code can reduce unnecessary resource loading and improve application performance; it supports dynamic data, and when the layout needs to be adjusted according to dynamic data, it is more convenient to adjust the layout parameters. However, its disadvantages are also more obvious: if the complex layout logic is all implemented through code, it will greatly reduce the readability and maintainability of the code and affect the overall structure of code processing; layout preview tools are integrated in development tools, but if they are set dynamically, the adjustment effect cannot be seen in the preview tool, making debugging difficult; using XML files is usually faster and more intuitive, and using code to set layout parameters will make the debugging effect invisible during the development process, which will increase development costs.
[0075] The layout file adaptation in res / layout is an important method of page adaptation in Android development. It has the following advantages: it provides multiple layouts to meet the page display needs of users in different scenarios, and the system API support is better; the Android development environment provides visual editing tools, allowing developers to intuitively edit and preview layout files; layout files can be shared by multiple activity pages or page fragments, which improves the reusability of code, helps reduce duplicate code, improves development efficiency, and helps maintain the unity and consistency of the application interface. However, it is difficult to achieve compatibility for multi-screen adaptation with different resolutions: although Android provides a variety of layout managers and adaptation tools, these styles are usually adapted for the current size, and there are problems with display on screens of other sizes, making adaptation difficult; and it is difficult to handle some situations where the display style needs to be determined based on conditions, and the dynamic adaptability is poor.
[0076] Layout resolution adaptation is an upgrade of layout file adaptation. It automatically adapts according to the device resolution. It solves the problem that the previous layout file adaptation method cannot handle screen adaptation of different resolutions. However, this adaptation method mainly provides layout resources based on static screen width information. It cannot dynamically adjust the page layout according to the real-time status of the device (such as screen switching, screen rotation, split screen mode, etc.). For such situations where the display style needs to be determined according to conditions, it still cannot handle it.
[0077] Therefore, an embodiment of the present invention provides a page multi-screen adaptation method, which can reload the active page and complete adaptive adaptation of the active page according to the screen resolution when the application switches the display screen, thereby realizing automatic adaptation when the screen is switched, so that users in different seats in the cabin can view the software information and operate it through the screen in front of the seat, and ensure the consistency of the page display content.
[0078] According to an embodiment of the present invention, an embodiment of a page multi-screen adaptation method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0079] In this embodiment, a page multi-screen adaptation method is provided, which can be used for devices that need to display application interfaces on multiple screens, such as vehicles with multiple display screens. Figure 2 is a flow chart of a page multi-screen adaptation method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0080] Step S201, if it is detected that the display screen used to display the active page switches to the target display screen, the resolution information of the target display screen and the page elements constituting the active page are obtained, and the page elements are hierarchically divided from top to bottom into active pages, page fragments, loop views and entry views, and the page elements of the lower layer are located in the page elements of the upper layer.
[0081] Specifically, when different users need to perform operations on the application activity page, the central control system will respond to the user's operation instructions and identify the target display screen that issued the request. You can add a configuration callback Activity.onConfigurationChanged(@NonNull Configuration config) in the current Activity page. When the page changes, the configuration callback will be triggered. By changing config.smallestScreenWidthDp or the DisplayId of the display screen, it can be determined whether the display screen has changed.
[0082] Specifically, when an application is started, an Activity is started. In Android applications, the unit of displaying a page is the Activity page, so the adaptation of the application page is also the adaptation of the Activity content. The Activity content is adapted one by one according to the carrying components, that is, the page elements, and the adaptation of all displayed content is completed. Figure 3 As shown in the figure, the Activity page is divided into layers, and the activity page is split from top to bottom into Activity, Fragment, RecyclerView, and ItemView. Figure 4 As shown, Activity contains multiple Fragments, Fragments contain multiple cyclic views (RecyclerView), and RecyclerView is bound to different item views ItemView. Figure 3 Each ItemView can be a ViewGroup that carries non-list content, or a ViewGroup that contains a child ReclclerView. It should be noted that if ItemView is a ViewGroup that contains a child RecyclerView, the final result is all the displayed content on the page: Activity-Fragment-RecyclerView-ItemView.
[0083] Step S202, determining a layout folder and a configuration file that match the resolution information, and using the layout folder and the configuration file to adapt the page elements one by one from top to bottom in the hierarchy to obtain adapted page elements.
[0084] Specifically, according to the hierarchical division of the above Activity page, the displayed activity page is divided into a structure such as Activity-Fragment-RecyclerView-ItemView, and then the page elements of each level are adapted one by one, and finally the adaptation closed loop of the entire activity page is realized. It should be noted that the adaptation process mainly includes the adaptation of the page element size and the adaptation of the page element content (mainly the layout content).
[0085] Furthermore, in the adaptation process, based on visual debugging, workload, and code maintainability, for the adaptive adaptation of Activity and Fragment, an adaptation solution based on the minimum resolution width (layout smallest-width, layout-sw) can be used to handle this part of the adaptation work. In general, the screen ID and screen resolution of each screen in the car computer are one-to-one corresponding, that is, the layout file corresponding to each screen can be determined by layout-sw, and the layout styles of different screens are differentiated in the layout file. In this way, while the layout style is flexibly set, the relationship between the page layout and control processing of different screens is decoupled, so that the adaptation work will not affect the page state processing and business logic processing, and the purity of the processing logic is guaranteed. And in view of the similarity of the page content, a large amount of content is replicable, and its debugging process is also visual, which can save a lot of work costs while simplifying the work content.
[0086] Furthermore, RecyclerView is a powerful list content display component. The Android system supports that the width or height of the RecyclerView list component will be dynamically adjusted as the content increases. When using it, if the RecyclerView width is fixed, its height will be dynamically calculated according to the content; or when using it, if the RecyclerView height is fixed, its width will be dynamically calculated according to the content. Therefore, according to the hierarchical division results of the Activity page, refer again Figure 3 , the components that need to be displayed on the Activity page are ultimately concentrated in the ItemView in the RecyclerView. That is to say, while adapting the size and content of the ItemView, the RecyclerView, Fragment, and Activity can be further adapted, thereby realizing the adaptation closed loop of the entire activity page.
[0087] In some optional implementations, the attribute information of the RecyclerView elements on different screens can be configured through a configuration (Config) file that matches the resolution information, and then after calculation based on the attribute information, the number of columns, spacing, ItemView width, ItemView height, etc. of the ItemView in the RecyclerView display content can be obtained, thereby achieving the adaptation of the ItemView size and the RecyclerView display content. At the same time, for the content adaptation of ItemView, the above-mentioned layout-sw solution can be used to adapt the content of ItemView under different screen resolutions. In this way, by determining the attribute information of RecyclerView, the size and content of ItemView, the adaptive adaptation of RecyclerView is completed.
[0088] Step S203: loading the adapted page elements so that the target display screen displays the adapted active page.
[0089] Specifically, after completing the hierarchical adaptation of each page element in the Activity page, the activity page of the application can be displayed on the target display screen by loading the adapted Activity-Fragment-RecyclerView-ItemView level by level, thereby realizing the switching of the activity page between screens.
[0090] The page multi-screen adaptation method provided in this embodiment obtains a layout file and a configuration file that match the resolution of the target display screen after detecting that the display screen has switched, and then splits the active page into active pages, page fragments, loop views, and entry views by level, and uses the layout file and the configuration file to independently adapt the page elements of each level one by one, thereby completing the dynamic adaptation of the entire active page when the screen switches, and the layered adaptation is conducive to differentiated processing and has greater flexibility.
[0091] The present invention decomposes the adaptation content layer by layer through page layer adaptation, layer-by-layer decomposition and combination of multiple adaptation schemes, divides different layers, and each layer independently and reasonably uses different adaptation methods, giving full play to the advantages of each basic adaptation method, completing the adaptation of each layer content, that is, completing the adaptation of the page content. This makes the adaptation work organized and easy to understand, and facilitates the subsequent development and maintenance work.
[0092] In this embodiment, a page multi-screen adaptation method is provided, which can be used for devices that need to display application interfaces on multiple screens, such as vehicles with multiple display screens. Figure 5 is a flow chart of a page multi-screen adaptation method according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:
[0093] Step S501: If it is detected that the display screen used to display the active page switches to the target display screen, the resolution information of the target display screen and the page elements constituting the active page are obtained. The page elements are divided into active pages, page fragments, loop views and item views from top to bottom in terms of hierarchy, and the lower-level page elements are located in the upper-level page elements. For details, please refer to Figure 2 Step S201 of the illustrated embodiment will not be described in detail here.
[0094] Step S502, determining a layout folder and a configuration file that match the resolution information, and using the layout folder and the configuration file to adapt the page elements one by one from top to bottom in the hierarchy to obtain adapted page elements.
[0095] Specifically, the above step S502 includes:
[0096] Step S5021: Obtain, according to the layout folder, an activity page layout file, a page fragment layout file, and an item view layout file that match the resolution information of the target display screen.
[0097] Specifically, you can create a layout folder in advance based on layout-sw, which includes layout files corresponding to display screens with different resolutions. First, determine the screen IDs and screen resolutions of all screens to be adapted, establish a mapping relationship between screen IDs and screen resolutions, and an association relationship between screen resolutions and layout files, and then create a layout-sw folder in the project res / directory according to the resolution. For example, Figure 6 As shown, if the screen id = 0 and the resolution is 1920×1080 (in dp), then add the layout folder layout-sw1080dp, and add the layout file layout_main_activity.xml in the folder according to the design drawing of the resolution, and edit the page content in layout_main_activity.xml; if the screen id = 1 and the resolution is 1920×720, then add the layout folder layout-sw720dp, and add the layout file layout_main_activity.xml in the folder according to the design drawing, and edit the page content in layout_main_activity.xml. It should be noted that the file name of the layout folder is determined according to the minimum width of the screen resolution.
[0098] Further, see again Figure 6When the page needs to be adapted on the target display screen, the layout folder and layout files under the corresponding resolution are loaded to obtain the activity page layout file layout_main_activity.xml, page fragment layout file layout_main_fragment.xml and item view layout file layout_main_itemview.xml that match the resolution of the target display screen.
[0099] Step S5022: adapt the active page based on the active page layout file to obtain an adapted active page, and adapt the page fragments based on the page fragment layout file to obtain adapted page fragments.
[0100] Specifically, according to the activity page layout file, the first size parameter of the activity page and the first layout information of the page elements in the activity page are configured to obtain the adapted activity page. The adaptive adaptation scheme of Activity is based on the adaptive adaptation of layout-sw, and the first size parameter of the Activity page is configured using layout_main_activity.xml. For example, the width and height attributes of the root node (root) are set to matche_parent according to the first size parameter. In the Android layout, match_parent is a value used to set the width and height attributes of the view. When the width and height attributes of the root node are set to match_parent, the root view will try to fill the entire available space of its parent container (i.e., the current display screen). In addition, the position, size, color, status, etc. of each element in the page are set and adjusted according to the first layout information. The size parameters in this embodiment are mainly used for size adaptation, and the layout information is mainly used for content adaptation.
[0101] The present invention sets the size parameters of the active page through the active page layout file to achieve size adaptation of the active page, sets the layout information of the page elements in the active page, and adapts the content of the active page so that the overall size and layout of the active page match the resolution of the target display screen, thereby improving the user's visual experience when switching application display screens.
[0102] Specifically, according to the page fragment layout file, the second size parameters of each page fragment in the active page and the second layout information of the page elements in the page fragment are configured to obtain the adapted page fragment. The adaptive adaptation scheme of Fragment is also based on the adaptive adaptation of layout-sw. The specific process is similar to the adaptive adaptation process of the above Activity, except that the layout file processed at this time is the page fragment layout file layout_main_fragment.xml, which will not be repeated here.
[0103] The present invention sets the size parameters of page fragments through a page fragment layout file to achieve size adaptation of page fragments in an active page, sets layout information of each page element in the page fragments, and adapts the display content of the page fragments to make the size layout of the page fragments in the active page match the resolution of the target display screen, thereby improving the user's visual experience when switching application display screens.
[0104] Step S5023: adapt the cyclic view and the item views in the cyclic view according to the configuration file and the item view layout file to obtain an adapted cyclic view and an adapted item view.
[0105] In some optional implementations, the above step S5023 includes:
[0106] Step a1, determining a first width and a first height of the cyclic view, and obtaining first attribute information of the cyclic view according to a configuration file; wherein the first attribute information includes at least some of the following items: inner spacing, number of entry rows, number of entry columns, item row spacing, item column spacing, and a parent cyclic view.
[0107] Specifically, for the RecyclerView list component, the system supports dynamic adjustment of the RecyclerView width or height as the content increases. Its height and width can be preset based on the screen resolution, or the width and height attributes of the RecyclerView root node can be set to match_parent.
[0108] Specifically, the Config configuration file is used to assist in the adaptive adaptation of RecyclerView and ItemView, such as Figure 7 As shown, by configuring the Config configuration file under different screen resolutions, you can obtain the current RecyclerView's display requirements for ItemView, such as the number of item rows, number of item columns, item row spacing, item column spacing, width, and height of ItemView.
[0109] For example, Figure 8As shown, the properties contained in the Config configuration file mainly include: the number of rows and columns of ItemView, the item row spacing (Item row spacing), the item column spacing (Item column spacing), the inner spacing of RecyclerView (top spacing, bottom spacing, row left spacing, row right spacing), item width (Item width), item height (Item height) and parent RecyclerView and other properties. Among them, the number of rows, columns, and item spacing are required properties, but the item spacing can have a default value to reduce the number of settings; the inner spacing of RecyclerView and the parent RecyclerView are optional properties and can be set as needed; the item width and item height are calculated from other properties in Config.
[0110] Step a2, adapting the cyclic view according to the first width, the first height and the first attribute information to obtain the adapted cyclic view, and calculating the second width and the second height of the item view in the cyclic view according to the first width, the first height and the first attribute information.
[0111] Specifically, the overall width of the item view is calculated according to the first width, the left row spacing and the right row spacing in the inner spacing, the number of item columns and the item column spacing, and the second width of the item view is calculated according to the ratio between the overall width of the item view and the number of item columns. The specific calculation formula is: second width = (first width - left row spacing - right row spacing - (number of item columns - 1) × item column spacing) / number of item columns.
[0112] Furthermore, the overall height of the item view is calculated based on the first height, the top spacing and the bottom spacing in the inner spacing, the number of item rows and the item row spacing. The second height of the item view is calculated based on the ratio of the overall height of the item view to the number of item rows. The specific calculation formula is: second height = (first height - top spacing - bottom spacing - (number of item rows - 1) × item row spacing) / number of item rows.
[0113] In some optional embodiments, such as Fig. 9 As shown, each RecyclerView corresponds to a Config configuration file, and each Config contains multiple sub-Configs according to the resolution. By configuring the RecyclerView.Config corresponding to each screen, the width and height of the ItemView in the RecyclerView can be calculated.
[0114] like Fig. 10A as well as Fig. 10B As shown, RecyclerView can support linear layout of vertical and horizontal columns; Fig. 10CAs shown, RecyclerView also supports grid layout; Fig. 10D As shown, RecyclerView also supports waterfall layout. Take RecyclerView linear layout-vertical column layout as an example. Fig.11 As shown, first create a Config configuration file for the RecyclerView of the current page and configure the sub-Configs at different resolutions. Then, create the RecyclerView adapter RecyclerView.Adapter on the current page and send the Config configuration file to the adapter Adapter. In the adapter Adapter, use the onCreateViewHolder method to create a container ViewHolder for storing the lower-level view references of RecyclerView (such as the item view ItemView), and use the onBindViewHolder method to establish the binding relationship between text and image data and the corresponding ItemView.
[0115] like Fig.12 As shown, through the Config configuration file, query the configuration information corresponding to the target display screen, mainly the top spacing, bottom spacing, left spacing, right spacing, item column spacing, loop view width and loop view height, and calculate the item width and item height of ItemView. Therefore, when the adapter of RecyclerView binds ItemView, the width and height of ItemView are dynamically adjusted.
[0116] The present invention calculates the second width and the second height of the item view according to the first attribute information of the cyclic view in the configuration file, and then adjusts the size of the item view using the second width and the second height, thereby achieving size adaptation of the item view.
[0117] Step a3: adapting the item views in the cyclic view according to the second width, the second height and the item view layout file to obtain an adapted item view.
[0118] Specifically, the size of the entry view is adjusted according to the second width and the second height, and the layout of the entry view is adjusted according to the entry view layout file to obtain the adapted entry view. The present invention uses the calculated second width and second height to adjust the size of the entry view to achieve size adaptation of the entry view, and performs content adaptation of the entry view according to the entry view layout file to achieve adaptive adaptation of the entry view in the target display screen, with high flexibility.
[0119] In some optional implementations, the size adaptive adaptation of ItemView is adjusted using the second width and second height calculated according to the Config configuration file. The content adaptive adaptation scheme of ItemView is based on layout-sw adaptive adaptation. Its implementation process can refer to the adaptation process of the Activity page, except that the layout file of ItemView is used at this time. It should be noted that the layout of ItemView may nest RecyclerView: when the ItemView layout does not contain RecyclerView, the adaptation of this stage is completed; when the ItemView layout contains RecyclerView, the subsequent adaptation of this stage is converted to the adaptation process of RecyclerView.
[0120] The present invention uses the attribute information recorded in the configuration file of the cyclic view to determine the width and height of the item views in the cyclic view, and uses the system component characteristics to combine and adapt the cyclic view and the item views in the cyclic view as the most basic adaptation units, thereby simplifying the adaptation work.
[0121] The present invention utilizes the characteristics of system components, takes RecyclerView and ItemView as the most basic adaptation units, and simplifies the adaptation work. Make full use of RecyclerView's support for various styles: linear list, grid list, and dislocated list, so that a row or a column can be regarded as a list, that is, a RecyclerView; and the content in a row or a column can be split and regarded as the sub-content of the list, that is, ItemView. In this way, the adaptation of a row or a column of content is converted into the adaptation of RecyclerView and ItemView. The characteristics of RecyclerView's fixed width (or height) and adaptive extension of height (or width) are utilized to simplify the adaptation content. Through Config configuration, the dynamically changed content is encapsulated, and then the width and height of ItemView are calculated to determine the size of the card content. The card content will be adjusted based on different resolutions, and ItemView will then reasonably select layout-sw adaptation, which can ensure the differentiated implementation of the content while ensuring its flexibility and scalability.
[0122] In the embodiment of the present invention, different adaptation methods are reasonably used to independently adapt the page elements at each level, and the active page, page fragments, cyclic views and item views located in the cyclic view are fully adapted, thereby completing the overall adaptation of the active page content, making the adaptation work organized, and facilitating subsequent development and maintenance work, thereby improving development efficiency and maintainability.
[0123] Step S503: load the adapted page elements so that the target display screen displays the adapted active page. Figure 2 Step S203 of the illustrated embodiment will not be described in detail here.
[0124] Step S504, obtaining the data status of each page fragment in the application activity page in the current display screen, and saving the data status, and restoring the data of each page fragment in the target display screen according to the data status.
[0125] In some optional implementations, all Fragment managers of the current active page are obtained, and the Fragment states and core APIs of each active page are obtained and saved: FragmentManager.saveFragmentInstanceState(fragment:Fragment):Fragment.Saved State. In this way, after detecting that the display screen is switched, the page is rotated, or the page is split, a corresponding new Fragment is created based on all Fragment classes of the current page, and the new Fragment is restored to the previous data state: FragmentManager.setInitialSavedState(state:SavedState). In addition, all Fragment classes of the current page are removed, and the newly created Fragment is added to the Fragment manager of the current active page. After the Fragment manager submits the above tasks, the active page starts the adaptive adaptation process of the above steps.
[0126] In this way, based on the system's support for saving and restoring the state of Activity and Fragment during page reconstruction, after completing page adaptation, the display content and state on the previous screen can be restored. When the application switches between different screens, it can complete adaptive adaptation and ensure the display content and state on the previous screen. Users do not need to re-acquire the operations and data on the previous screen, which is conducive to users viewing other users' settings information and improving user experience.
[0127] The present invention obtains and saves the previous data states of each page fragment in the active page, and after the screen is switched, restores each page fragment in the target display screen to the previous state, thereby ensuring the consistency of the content displayed on the active page before and after the screen is switched, without the user having to re-operate the active page, thereby improving the user experience.
[0128] The page multi-screen adaptation method of the present invention is described in detail below with reference to a specific application example.
[0129] This application example splits the activity page into Activity, Fragment, RecyclerView, and ItemView layer by layer, and adapts the page elements at each level respectively. The adaptation scheme is shown in Table 1 below:
[0130] Table 1 Adaptation solutions for each page element
[0131] Root node size adaptation Content Adaptation Activity Width and height: match_parent layout_sw adaptation Fragment Width and height: match_parent layout_sw adaptation RecyclerView Width and height: match_parent RecyclerView Adaptation ItemView Width and height: Config calculation results layout_sw adaptation
[0132] like Fig.13 As shown, when the application is started on any screen, the activity page is reloaded, which triggers the adaptive loading and adaptation process of the activity page, and then triggers the layout-sw adaptive adaptation of Activity, Fragment, and ItemView and the adaptive adaptation of RecyclerView.
[0133] like Fig.14 As shown in the figure, when the application switches between different screens, it will judge the screen switching based on the configuration changes of the current page, and will save the data status of the current fragments through Activity.FragmengManager, then remove each fragment, create a new fragment and restore the saved data status. The adaptive adaptation process of the page will be triggered during the reloading of each fragment, and the page data status will be restored.
[0134] Taking the smart cockpit based on Android system as an example, the present invention can make the application page adaptively adapt to screens with different resolutions, automatically complete page adaptation and display the same content when switching between screens. Users in different seats in the smart cockpit can view the information of the application software and operate it through the screen in front of the seat, such as FIG. 15A to FIG. 15D As shown, the screen sizes and resolutions of users in different seats are different, among which, Fig.15A The resolution of the middle screen 1 is 560×380. Fig. 15B The resolution of the middle screen 2 is 560×300. Fig. 15C The resolution of the middle screen 3 is 450×380. Fig.15D The resolution of the middle screen 4 is 450×300, but through the page multi-screen adaptation method of the present invention, the same content can be viewed on different screens, providing users with a more complete visual experience and a more convenient control experience.
[0135] like Fig.16 As shown, when the application page switches between multiple screens, the present invention can realize the adaptive adaptation of the application page when the screens switch, realize the differential display of the pages, and ensure the adaptation and consistency of the displayed content data and status between different screens.
[0136] It should be noted that the scenarios in which the present invention can be applied include but are not limited to multi-screen adaptive adaptation of car computers, adaptive adaptation of mobile applications based on the Android system, and adaptive adaptation of TV applications based on the Android system, as long as it involves switching of application pages between multiple screens.
[0137] The present invention organizes and templates the adaptation work of the entire page content by splitting the page into layers, so that the adaptation work of each part becomes easy to understand and easy to operate.
[0138] After the page is divided into layers, each layer content can support differentiated processing of the page, adjust the combined display of the page contents, make style differences according to the screen position, and make differentiated content increase and decrease processing according to the screen resolution, with good flexibility and strong scalability.
[0139] The differentiated processing of the page content of the present invention is finally realized through layout-sw and RecyelerView adaptation. The layout-sw adaptation is to perform differentiated processing in the layout file, which will not affect the logic in the class source code of the processing status and processing business logic; the RecyclerView adaptation is to encapsulate the variable part into the Config configuration file, which concisely and clearly encapsulates the part used to achieve differentiation, ensuring the purity and consistency of the processing status and processing business logic in the class source code.
[0140] The class source code for processing page status and business logic in the present invention is the same, and only one set of class source code needs to be developed and maintained, which saves development and maintenance costs while ensuring the purity of the class source code processing logic. The layout-sw part of content differentiation processing can complete the entire adaptation work after paying the cost of copying and adjustment, and the development cost is low. At the same time, the entire processing flow is structured and templated, and the encapsulated structure makes the sorting and processing more concise and more cost-effective.
[0141] In this embodiment, a page multi-screen adaptation device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0142] This embodiment provides a page multi-screen adaptation device, such as Fig.17 As shown, including:
[0143] The first processing module 171 is used to obtain the resolution information of the target display screen and the page elements constituting the active page if it is detected that the display screen of the application active page is switched, wherein the page elements are hierarchically divided from top to bottom into active pages, page fragments, loop views and item views, and the page elements of the lower layer are located in the page elements of the upper layer;
[0144] The second processing module 172 is used to determine a layout folder and a configuration file that match the resolution information, and use the layout folder and the configuration file to adapt the page elements one by one from top to bottom according to the hierarchy to obtain the adapted page elements;
[0145] The third processing module 173 is used to load the adapted page elements so that the target display screen displays the adapted active page.
[0146] In some optional implementations, the second processing module 172 is further configured to:
[0147] According to the layout folder, an activity page layout file, a page fragment layout file and an item view layout file matching the resolution information of the target display screen are obtained;
[0148] Adapting the active page based on the active page layout file to obtain an adapted active page, and adapting the page fragments based on the page fragment layout file to obtain adapted page fragments;
[0149] The cyclic view and the item views in the cyclic view are adapted according to the configuration file and the item view layout file to obtain the adapted cyclic view and the adapted item views.
[0150] In some optional implementations, the second processing module 172 is further configured to:
[0151] According to the active page layout file, a first size parameter of the active page and first layout information of page elements in the active page are configured to obtain an adapted active page.
[0152] In some optional implementations, the second processing module 172 is further configured to:
[0153] According to the page fragment layout file, second size parameters of each page fragment located in the active page and second layout information of the page elements in the page fragment are configured to obtain adapted page fragments.
[0154] In some optional implementations, the second processing module 172 is further configured to:
[0155] Determine a first width and a first height of the cyclic view, and obtain first attribute information of the cyclic view according to the configuration file; wherein the first attribute information includes at least some of the following items: inner spacing, number of entry rows, number of entry columns, entry row spacing, entry column spacing, and parent cyclic view;
[0156] Adapting the cyclic view according to the first width, the first height and the first attribute information to obtain an adapted cyclic view, and calculating a second width and a second height of the item view in the cyclic view according to the first width, the first height and the first attribute information;
[0157] The item views in the cyclic view are adapted according to the second width, the second height and the item view layout file to obtain an adapted item view.
[0158] In some optional implementations, the second processing module 172 is further configured to:
[0159] The overall width of the item view is calculated according to the first width, the left row spacing and the right row spacing in the inner spacing, the number of item columns, and the item column spacing; and the second width of the item view is calculated according to the ratio between the overall width of the item view and the number of item columns;
[0160] The overall height of the item view is calculated according to the first height, the top spacing and the bottom spacing in the inner spacing, the number of item rows and the item row spacing; and the second height of the item view is calculated according to the ratio between the overall height of the item view and the number of item rows.
[0161] In some optional implementations, the second processing module 172 is further configured to:
[0162] The size of the entry view is adjusted according to the second width and the second height, and the layout of the entry view is adjusted according to the entry view layout file to obtain an adapted entry view.
[0163] In some optional implementations, after detecting that the display screen of the application page is switched, the device is further used to: obtain the data state of each page fragment in the application activity page in the current display screen, and save the data state;
[0164] After loading the adapted page elements, the device is also used to:
[0165] According to the data status, data recovery is performed on each page fragment in the target display screen.
[0166] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0167] The page multi-screen adaptation device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0168] The embodiment of the present invention further provides a vehicle having the above Fig.17 The page shown is adapted for multiple screen devices.
[0169] See also Fig.18 , Fig.18 is a schematic diagram of the structure of a vehicle provided by an optional embodiment of the present invention, such as Fig.18 As shown, the vehicle includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common motherboard or installed in other ways as needed. The processor can process instructions executed in the vehicle, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.18 A processor 10 is taken as an example.
[0170] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0171] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0172] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created according to the use of the vehicle, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the vehicle via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0173] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0174] The vehicle further includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Fig.18 The example of connecting through bus is taken in the following.
[0175] The input device 30 can receive input digital or character information and generate key signal input related to the user settings and function control of the vehicle, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device may be a touch screen.
[0176] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0177] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0178] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for adapting a page to multiple screens, characterized in that: The method comprises: If it is detected that the display screen for displaying the active page is switched to the target display screen, the resolution information of the target display screen and the page elements constituting the active page are obtained, and the page elements are hierarchically divided from top to bottom into the active page, page fragments, loop views and item views, and the page elements of the lower layer are located in the page elements of the upper layer; Determine a layout folder and configuration file that matches the resolution information, and use the layout folder and configuration file to adapt the page elements one by one from top to bottom according to the hierarchy to obtain the adapted page elements; The adapted page elements are loaded so that the target display screen displays the adapted active page.
2. The method according to claim 1, characterized in that The layout folder and the configuration file are used to adapt the page elements one by one from top to bottom according to the hierarchy to obtain the adapted page elements, including: According to the layout folder, an activity page layout file, a page fragment layout file and an item view layout file matching the resolution information of the target display screen are obtained; Adapting the active page based on the active page layout file to obtain an adapted active page, and adapting the page fragments based on the page fragment layout file to obtain adapted page fragments; The cyclic view and the item views in the cyclic view are adapted according to the configuration file and the item view layout file to obtain the adapted cyclic view and the adapted item views.
3. The method according to claim 2, characterized in that The step of adapting the cyclic view and the item views in the cyclic view according to the configuration file and the item view layout file to obtain the adapted cyclic view and the adapted item views includes: Determine a first width and a first height of the cyclic view, and obtain first attribute information of the cyclic view according to the configuration file; wherein the first attribute information includes at least some of the following items: inner spacing, number of entry rows, number of entry columns, entry row spacing, entry column spacing, and parent cyclic view; Adapting the cyclic view according to the first width, the first height and the first attribute information to obtain an adapted cyclic view, and calculating a second width and a second height of the item view in the cyclic view according to the first width, the first height and the first attribute information; The item views in the cyclic view are adapted according to the second width, the second height and the item view layout file to obtain an adapted item view.
4. The method according to claim 3, characterized in that The step of adapting the item view in the cyclic view according to the second width, the second height and the item view layout file to obtain the adapted item view includes: The size of the entry view is adjusted according to the second width and the second height, and the layout of the entry view is adjusted according to the entry view layout file to obtain an adapted entry view.
5. The method according to claim 3, characterized in that: The step of calculating the second width and the second height of the item view in the cyclic view according to the first width, the first height and the first attribute information includes: The overall width of the item view is calculated according to the first width, the left row spacing and the right row spacing in the inner spacing, the number of item columns, and the item column spacing; and the second width of the item view is calculated according to the ratio between the overall width of the item view and the number of item columns; The overall height of the item view is calculated according to the first height, the top spacing and the bottom spacing in the inner spacing, the number of item rows and the item row spacing; and the second height of the item view is calculated according to the ratio between the overall height of the item view and the number of item rows.
6. The method according to any one of claims 2 to 5, characterized in that: The step of adapting the activity page based on the activity page layout file to obtain the adapted activity page includes: According to the active page layout file, a first size parameter of the active page and first layout information of page elements in the active page are configured to obtain an adapted active page.
7. The method according to any one of claims 2 to 5, characterized in that: Adapt the page fragments based on the page fragment layout file to obtain the adapted page fragments, including: According to the page fragment layout file, second size parameters of each page fragment located in the active page and second layout information of the page elements in the page fragment are configured to obtain adapted page fragments.
8. The method according to any one of claims 2 to 5, characterized in that: After detecting that the display screen of the application page is switched, the method further includes: Obtaining data status of each page fragment in the application activity page in the current display screen, and saving the data status; After loading the adapted page element, the method further includes: According to the data state, data recovery is performed on each page fragment in the target display screen.
9. A device for adapting a page to multiple screens, characterized in that: The device comprises: The first processing module is used for obtaining the resolution information of the target display screen and the page elements constituting the active page if it is detected that the display screen of the application active page is switched, wherein the page elements are hierarchically divided into active page, page fragments, loop view and item view from top to bottom, and the page elements of the lower layer are located in the page elements of the upper layer; The second processing module is used to determine the layout folder and configuration file that match the resolution information, and use the layout folder and configuration file to adapt the page elements one by one from top to bottom according to the hierarchy to obtain the adapted page elements; The third processing module is used to load the adapted page elements so that the target display screen displays the adapted active page.
10. A vehicle, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the page multi-screen adaptation method according to any one of claims 1 to 8 by executing the computer instructions.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the page multi-screen adaptation method according to any one of claims 1 to 8.
12. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to enable a computer to execute the page multi-screen adaptation method according to any one of claims 1 to 8.