Interface display adaptation method and device based on Android client

By obtaining device and personalized parameters, calculating display scale factors, and adjusting the Android client interface layout, the problem of different text size adaptability of the Android system on different devices and user settings is solved, and the user experience is improved.

CN119201326APending Publication Date: 2024-12-27GUIYANG YUWAN SCI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411376953.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The Android system cannot dynamically adjust the text size on different devices and user settings, resulting in different display effects and affecting the user experience. Especially for users who need large font displays, the adaptability is not good.

Method used

By obtaining device parameters (screen size, resolution, physical pixel density) and personalized display parameters (density scale factor, font scale factor, display mode), calculate and apply display scale factor, adjust the interface layout within the Android client application, Ensure the adaptability of text and UI elements.

Benefits of technology

The display adaptation under different devices and user settings is realized, which improves the user experience, especially for users who need large font display, which solves the adaptability problem and avoids the problem of element coverage and incomplete display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201326A_ABST
    Figure CN119201326A_ABST
Patent Text Reader

Abstract

The invention provides an interface display adaptation method and device based on an Android client, and the method comprises the steps: obtaining equipment parameters and personalized display parameters of current equipment, the equipment parameters comprise a screen size, a resolution ratio and a physical pixel density, and the personalized display parameters comprise a current density scale factor, a font scale factor and a display mode; adjusting the interface layout in the Android client application according to the equipment parameters of the current equipment and the personalized display parameters; and loading and displaying the adjusted interface layout in the application. In this way, the actual parameters (such as screen size, resolution and pixel density) of the equipment and personalized preferences (such as font scale factors and display modes) of the user can be considered to perform dynamic adjustment, so that display adaptation on different equipment and different user settings is realized, the adaptation problem of multiple equipment and user personalization is effectively solved, and the user experience is improved. And user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Android development technology, and more specifically, to an interface display adaptation method and device based on an Android client. Background Art

[0002] With the popularity and enhanced functionality of mobile devices (such as Android smartphones and tablets), users' demands for text size adaptation are becoming more diverse and personalized. As one of the most popular mobile operating systems, Android faces the challenge of ensuring text display effects and user experience on different devices.

[0003] Currently, the Android system provides some barrier-free features, such as a magnifying glass and subtitle display, to help visually impaired users. These features provide some enhanced options for text display, but usually do not involve dynamic adjustment of text size within the application. In addition, the Android system provides some barrier-free features, such as a magnifying glass and subtitle display, to help visually impaired users. These features provide some enhanced options for text display, but usually do not involve dynamic adjustment of text size within the application.

[0004] Therefore, the font size settings in most applications on the Android system are also fixed and cannot be dynamically adjusted according to the actual parameters of the device (such as screen size, resolution, pixel density, etc.) and the user's personalized preferences (such as vision conditions, ambient brightness, etc.). This leads to differences in display effects on different devices and different user settings (i.e., poor adaptability), affecting the user experience. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide an interface display adaptation method and device based on an Android client to solve the adaptability problems of multiple devices and user personalization (especially for users who require large font display) and improve user experience.

[0006] In order to achieve the above purpose, the embodiments of the present application are implemented in the following manner:

[0007] In the first aspect, an embodiment of the present application provides an interface display adaptation method based on an Android client, including: obtaining device parameters and personalized display parameters of the current device, wherein the device parameters include screen size, resolution, and physical pixel density, and the personalized display parameters include the current density scale factor, font scale factor, and display mode; adjusting the interface layout within the Android client application according to the device parameters and personalized display parameters of the current device; loading and displaying the adjusted interface layout within the application.

[0008] In combination with the first aspect, in a first possible implementation method of the first aspect, the interface layout within the Android client application is adjusted according to the device parameters and personalized display parameters of the current device, including: calculating a reference density scale factor based on the physical pixel density of the current device and the Android application development benchmark pixel density; calculating a display scale factor based on the reference density scale factor and the current density scale factor; and adjusting the interface layout within the Android client application based on the screen size, resolution, reference density scale factor, display scale factor, font scale factor, and display mode.

[0009] In combination with the first possible implementation method of the first aspect, in a second possible implementation method of the first aspect, a reference density scaling factor is calculated based on the physical pixel density of the current device and the Android application development benchmark pixel density, including: obtaining the Android application development benchmark pixel density; calculating the ratio of the physical pixel density to the benchmark pixel density as the reference density scaling factor.

[0010] In combination with the first possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, a display scale factor is calculated based on a reference density scale factor and a current density scale factor, including: calculating a ratio of the current density scale factor to the reference density scale factor as the display scale factor.

[0011] In combination with the first possible implementation method of the first aspect, in a fourth possible implementation method of the first aspect, the interface layout within the Android client application is adjusted based on the screen size, resolution, reference density scale factor, display scale factor, font scale factor and display mode, including: for the text elements of the interface layout within the Android client application: based on the screen size, resolution, reference density scale factor, font scale factor and scaling-independent pixels of the text elements, the text elements of the interface layout within the Android client application are adjusted; for the UI elements of the interface layout within the Android client application: based on the screen size, resolution, reference density scale factor, display scale factor and density-independent pixels of the UI elements, the UI elements of the interface layout within the Android client application are adjusted; based on the display mode, the corresponding display mode within the Android client application is enabled.

[0012] In combination with the fourth possible implementation method of the first aspect, in a fifth possible implementation method of the first aspect, based on the screen size, resolution, reference density scale factor, font scale factor and scaling-independent pixels of the text elements, the text elements of the interface layout within the Android client application are adjusted, including: determining the upper limit of the font size of the text elements based on the width of the screen size; multiplying the scaling-independent pixels of the text elements by the reference density scale factor and the font scale factor to obtain the font pixel parameters corresponding to the text elements, and then calculating the target font width and height corresponding to the text elements based on the font pixel parameters and the resolution; determining whether the target font width and height corresponding to the text elements exceeds the upper limit of the font size of the text elements; if it exceeds the upper limit of the font size, adjusting the text elements of the interface layout within the Android client application to the upper limit of the font size; if it does not exceed the upper limit of the font size, adjusting the text elements of the interface layout within the Android client application to the target font width and height.

[0013] In combination with the fourth possible implementation manner of the first aspect, in a sixth possible implementation manner of the first aspect, based on the screen size, resolution, reference density scale factor, display scale factor and density-independent pixels of the UI elements, the UI elements of the interface layout within the Android client application are adjusted, including: determining the upper limit of the UI size of the UI elements based on the width of the screen size; multiplying the density-independent pixels of the UI elements by the reference density scale factor and the display scale factor to obtain the UI pixel parameters corresponding to the UI elements, and then calculating the target UI width and height corresponding to the UI elements based on the UI pixel parameters and the resolution; determining whether the target UI width and height corresponding to the UI elements exceeds the upper limit of the UI size of the UI elements; if it exceeds the upper limit of the UI size, adjusting the UI elements of the interface layout within the Android client application to the upper limit of the UI size; if it does not exceed the upper limit of the UI size, adjusting the UI elements of the interface layout within the Android client application to the target UI width and height.

[0014] In the second aspect, an embodiment of the present application provides an interface display adaptation device based on an Android client, including: a parameter acquisition unit, used to obtain device parameters and personalized display parameters of the current device, wherein the device parameters include screen size, resolution, and physical pixel density, and the personalized display parameters include the current density scale factor, font scale factor, and display mode; an interface adjustment unit, used to adjust the interface layout within the Android client application according to the device parameters and personalized display parameters of the current device; an interface display unit, used to load and display the adjusted interface layout within the application.

[0015] In a third aspect, an embodiment of the present application provides a storage medium, which is arranged in a device and includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the interface display adaptation method based on the Android client as described in the first aspect or any one of the possible implementation methods of the first aspect.

[0016] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions, and the program instructions, when loaded and executed by the processor, implement the steps of the interface display adaptation method based on the Android client as described in the first aspect or any one of the possible implementation methods of the first aspect.

[0017] Beneficial effects:

[0018] 1. By obtaining the device parameters (screen size, resolution, physical pixel density) and personalized display parameters (current density scale factor, font scale factor and display mode) of the current device, the interface layout in the Android client application is adjusted according to the device parameters and personalized display parameters of the current device, so as to load and display the adjusted interface layout in the application. Such a solution can take into account the actual parameters of the device (such as screen size, resolution, pixel density, etc.) and the personalized preferences of the user (such as vision conditions, ambient brightness, etc., reflected by font scale factor and display mode) to make dynamic adjustments, thereby achieving display adaptation on different devices and different user settings, effectively solving the compatibility issues of multiple devices and user personalization (especially for users who need large font display), and improving user experience.

[0019] 2. Based on the physical pixel density of the current device and the Android application development benchmark pixel density, calculate the reference density scale factor (obtain the Android application development benchmark pixel density, calculate the ratio of the physical pixel density to the benchmark pixel density, and use it as the reference density scale factor); based on the reference density scale factor and the current density scale factor, calculate the display scale factor (calculate the ratio of the current density scale factor to the reference density scale factor as the display scale factor); the display scale factor thus calculated can play a key role in adjusting UI elements, taking into account not only the parameters of different devices but also the user's personalized display mode (such as zoom mode), so that UI elements can be effectively adapted on different devices and under different user preferences.

[0020] 3. For the text elements of the interface layout within the Android client application, use the screen size, resolution, reference density scale factor, font scale factor and scaling-independent pixels of the text elements to adjust the text elements of the interface layout within the Android client application (specifically determine the upper limit of the font size of the text element based on the width of the screen size; multiply the scaling-independent pixels of the text element by the reference density scale factor and the font scale factor to obtain the font pixel parameters corresponding to the text element, and then calculate the target font width and height corresponding to the text element based on the font pixel parameters and resolution; determine whether the target font width and height corresponding to the text element exceeds the upper limit of the font size of the text element, and adjust the text elements of the interface layout within the Android client application accordingly). For the UI elements of the interface layout in the Android client application: based on the screen size, resolution, reference density scale factor, display scale factor and density-independent pixels of the UI elements, adjust the UI elements of the interface layout in the Android client application (determine the UI size upper limit of the UI element based on the width of the screen size; multiply the density-independent pixels of the UI element by the reference density scale factor and the display scale factor to obtain the UI pixel parameters corresponding to the UI element, and then calculate the target UI width and height corresponding to the UI element based on the UI pixel parameters and resolution; determine whether the target UI width and height corresponding to the UI element exceeds the UI size upper limit of the UI element, and adjust the UI elements of the interface layout in the Android client application accordingly). Then, based on the display mode (such as warm and cold tones, daytime and nighttime modes, etc.), enable the corresponding display mode in the Android client application. In this way, fine-grained adaptation and adjustment can be performed for UI elements and font elements respectively, and by setting upper limits, problems such as overlap and incomplete display between different elements can be avoided, effectively completing display adaptation under various devices and user preferences.

[0021] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0023] Figure 1 A flowchart of an interface display adaptation method based on an Android client provided in an embodiment of the present application.

[0024] Figure 2This is a structural block diagram of an interface display adapter device based on an Android client.

[0025] Icons: 10-interface display adaptation device based on Android client; 11-parameter acquisition unit; 12-interface adjustment unit; 13-interface display unit. DETAILED DESCRIPTION

[0026] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0027] The interface display adaptation method based on the Android client provided in this embodiment is applied to electronic devices (such as smart phones, tablets, etc.) installed with the Android client. This embodiment introduces the interface display adaptation method with the Android client installed in the electronic device as the execution subject.

[0028] First, this solution has many different application scenarios, such as running an Android client on an electronic device in normal use (e.g., using the same electronic device for a long time), running an Android client when a user changes devices, etc. When the Android client is running, it will perform detection, such as determining whether the device has been replaced by using the device's unique identifier, determining whether the user logged in to the device has changed by detecting the user account, etc., so as to obtain information such as the corresponding device and user preferences.

[0029] To facilitate understanding of the present solution, this embodiment takes a new user using a new device (i.e., the electronic device has not been used to run the corresponding Android client program) to run the Android client as an example to provide a comprehensive introduction to the present solution.

[0030] See also Figure 1 , Figure 1 A flowchart of an interface display adaptation method based on an Android client is provided in an embodiment of the present application. In this embodiment, the interface display adaptation method based on an Android client may include step S10, step S20 and step S30.

[0031] First, when the user runs the Android client through the electronic device, the Android client can run step S10 during the startup initialization phase.

[0032] Step S10: Obtain device parameters and personalized display parameters of the current device, wherein the device parameters include screen size, resolution, and physical pixel density, and the personalized display parameters include current density scaling factor, font scaling factor, and display mode.

[0033] In this embodiment, the Android client can obtain device parameters and personalized display parameters of the current device. The device parameters include screen size, resolution, and physical pixel density. The personalized display parameters include current density scaling factor, font scaling factor, and display mode.

[0034] Specifically, information such as screen size, resolution, and physical pixel density can be obtained by using the DisplayMetrics class: Get the DisplayMetrics object through the Context's getResources().getDisplayMetrics() method. This object contains information such as the device's screen width, height, and physical pixel density.

[0035] The personalized display parameters include the current density scale factor, font scale factor and display mode.

[0036] Current density scale factor: The current pixel density of the screen (different from the physical pixel density) is the scale ratio of the screen relative to MDPI (the Android application development benchmark pixel density mentioned later, with a value of 160). The current density scale factor takes into account the physical pixel density of the current device and whether the display is magnified. It is different from the reference density scale factor calculated based on the physical pixel density of the current device and the Android application development benchmark pixel density (the reference density scale factor is the density scale factor when the display is not magnified). The current density scale factor can be obtained through the density field in the DisplayMetrics class. The density field in the DisplayMetrics class is the density scale factor (referred to as the current density scale factor in this solution).

[0037] Font scale factor: Android allows users to adjust the font size through system settings, which will affect the display size of the text in the application. Therefore, the font scale factor is used to reflect this adjustment. The font scale factor can be obtained through configuration.fontScale. In Android, the Configuration class contains the current configuration information of the device, including the font scale factor (fontScale). This value can be obtained through the Activity's getResources().getConfiguration().fontScale.

[0038] Display mode: Display mode refers to the color mode and brightness mode of the screen (the Android client in this embodiment mainly designs corresponding display modes for warm and cold tones, daytime and nighttime modes, etc.). For the display mode, it can be obtained through the API or settings (Settings.System class). Specifically, in Android, obtaining the night mode status of an application or system can be achieved by accessing the AppCompatDelegate in the Context. Starting from Android Pie (9.0), the system introduced the concept of night mode, and it has been enhanced in subsequent versions. Generally, we think that the night mode is darker.

[0039] After obtaining the device parameters and personalized display parameters of the current device, the Android client may execute step S20.

[0040] Step S20: adjusting the interface layout within the Android client application according to the device parameters and personalized display parameters of the current device.

[0041] In this embodiment, the Android client can calculate the reference density scaling factor based on the physical pixel density of the current device and the Android application development benchmark pixel density (ie, MDPI, with a value of 160).

[0042] Specifically, the Android client can obtain the Android application development benchmark pixel density (MDPI, the value is 160), and then calculate the ratio of the physical pixel density to the benchmark pixel density as a reference density scaling factor.

[0043] Then, the Android client may calculate the display scale factor based on the reference density scale factor and the current density scale factor. Specifically, the Android client may calculate the ratio of the current density scale factor to the reference density scale factor as the display scale factor.

[0044] Afterwards, the Android client can adjust the interface layout within the Android client application based on the screen size, resolution, reference density scale factor, display scale factor, font scale factor and display mode.

[0045] Exemplarily, for text elements in the interface layout within an Android client application: the Android client can adjust the text elements in the interface layout within the Android client application based on the screen size, resolution, reference density scale factor, font scale factor and scaling-independent pixels of the text elements.

[0046] Specifically, the Android client can determine the upper limit of the font size of text elements based on the width of the screen size. For example, by obtaining the width of the screen size, the proportion of each control in a row is calculated; for example, there is a picture A and text B in a row, picture A occupies two parts, text B occupies one part, and the maximum width of the screen is calculated to be 300dp, then the maximum width of picture A is 200dp, and the maximum width of text B is 100dp. At this time, we will set the maximum font width of text B to 100dp. Of course, this is just an example and should not be regarded as a limitation of this application.

[0047] Then, multiply the scale-independent pixels of the text element (i.e., how many scale-independent pixels are needed for the text element to be displayed, similar to the density-independent pixels used in UI element design, which is set during development) by the reference density scale factor and the font scale factor to obtain the font pixel parameters corresponding to the text element, and then calculate the target font width and height corresponding to the text element based on the font pixel parameters and resolution (this calculation is relatively simple, and the target font width and height can be determined by the ratio of the font pixel parameters to the resolution). Calculating this target font width and height is mainly used to determine whether the text element will exceed the limit (such as overlapping, incomplete display, etc.) if it is directly adjusted according to the scale-independent pixels, reference density scale factor, and font scale factor.

[0048] Afterwards, the Android client can determine whether the target font width and height corresponding to the text element exceeds the upper limit of the font size of the text element: if it exceeds the upper limit, the text elements of the interface layout within the Android client application are adjusted to the upper limit of the font size (by reversely calculating the appropriate font scale factor, and then adjusting it through the Android client); if it does not exceed the upper limit of the font size, the text elements of the interface layout within the Android client application can be adjusted to the target font width and height through the Android client.

[0049] Exemplarily, for UI elements of the interface layout within an Android client application: based on the screen size, resolution, reference density scale factor, display scale factor and density-independent pixels of the UI elements, adjust the UI elements of the interface layout within the Android client application.

[0050] Specifically, the Android client can determine the upper limit of the UI size of the UI element based on the width of the screen size. For example, for a UI element, by also obtaining the maximum width of the screen, for example, there are two UI elements with picture controls in a row, and the sizes of the UI elements of the two picture controls are fixed. There is another UI element with a control that needs to be adjusted accordingly, then the size of this UI element can be calculated by subtracting the maximum width pixels from the two pictures, and then the upper limit of the UI size of this UI element can be calculated.

[0051] Then, multiply the density-independent pixels of the UI element (that is, how many scale-independent pixels the UI element needs to display, which is set during development) by the reference density scale factor and the display scale factor to obtain the UI pixel parameters corresponding to the UI element, and then calculate the target UI width and height corresponding to the UI element based on the UI pixel parameters and resolution (this calculation is also relatively simple, and the target UI width and height can be determined by the ratio of the UI pixel parameters to the resolution). Calculating this target UI width and height is used to determine whether the UI element will exceed the limit (such as overlapping, incomplete display, etc.) if it is directly adjusted according to the density-independent pixels, the reference density scale factor, and the display scale factor.

[0052] Afterwards, the Android client can determine whether the target UI width and height corresponding to the UI element exceeds the UI size upper limit of the UI element:

[0053] If the UI size exceeds the upper limit, the UI elements of the interface layout in the Android client application are adjusted to the upper limit of the UI size (here you can also reversely calculate the appropriate display scale factor and then adjust it through the Android client); if the UI size does not exceed the upper limit, the UI elements of the interface layout in the Android client application are adjusted to the target UI width and height.

[0054] After completing the adjustment of the text elements and UI elements of the interface layout within the Android client application, the Android client can further enable the corresponding display mode within the Android client application based on the display mode (such as cool color theme, warm color theme, daytime theme, nighttime theme, etc.) (the corresponding display mode is set in the Android client application).

[0055] After completing the adjustment of the interface layout in the Android client application, the Android client may execute step S30.

[0056] Step S30: Loading and displaying the adjusted in-application interface layout.

[0057] In this embodiment, the Android client can load and display the adjusted in-application interface layout to complete interface display adaptation.

[0058] See also Figure 2 Based on the same inventive concept, the embodiment of the present application also provides an interface display adaptation device 10 based on an Android client, comprising:

[0059] The parameter acquisition unit 11 is used to acquire device parameters and personalized display parameters of the current device, wherein the device parameters include screen size, resolution, and physical pixel density, and the personalized display parameters include current density scale factor, font scale factor, and display mode.

[0060] The interface adjustment unit 12 is used to adjust the interface layout within the Android client application according to the device parameters and personalized display parameters of the current device.

[0061] The interface display unit 13 is used to load and display the adjusted in-application interface layout.

[0062] In this embodiment, the interface adjustment unit 12 is specifically used to: calculate a reference density scale factor based on the physical pixel density of the current device and the Android application development benchmark pixel density; calculate a display scale factor based on the reference density scale factor and the current density scale factor; and adjust the interface layout within the Android client application based on the screen size, resolution, reference density scale factor, display scale factor, font scale factor, and display mode.

[0063] In this embodiment, the interface adjustment unit 12 is specifically used to: obtain the Android application development benchmark pixel density; calculate the ratio of the physical pixel density to the benchmark pixel density as a reference density ratio factor.

[0064] In this embodiment, the interface adjustment unit 12 is specifically used to calculate the ratio of the current density scale factor to the reference density scale factor as the display scale factor.

[0065] In this embodiment, the interface adjustment unit 12 is specifically used for: for the text elements of the interface layout within the Android client application: based on the screen size, resolution, reference density scale factor, font scale factor and scaling-independent pixels of the text elements, adjusting the text elements of the interface layout within the Android client application; for the UI elements of the interface layout within the Android client application: based on the screen size, resolution, reference density scale factor, display scale factor and density-independent pixels of the UI elements, adjusting the UI elements of the interface layout within the Android client application; enabling the corresponding display mode within the Android client application based on the display mode.

[0066] In this embodiment, the interface adjustment unit 12 is specifically used to: determine the upper limit of the font size of the text element based on the width of the screen size; multiply the scaling-independent pixels of the text element by the reference density scale factor and the font scale factor to obtain the font pixel parameters corresponding to the text element, and then calculate the target font width and height corresponding to the text element based on the font pixel parameters and the resolution; determine whether the target font width and height corresponding to the text element exceeds the upper limit of the font size of the text element; if it exceeds the upper limit of the font size, adjust the text elements of the interface layout within the Android client application to the upper limit of the font size; if it does not exceed the upper limit of the font size, adjust the text elements of the interface layout within the Android client application to the target font width and height.

[0067] In this embodiment, the interface adjustment unit 12 is specifically used to: determine the upper limit of the UI size of the UI element based on the width of the screen size; multiply the density-independent pixels of the UI element by the reference density scale factor and the display scale factor to obtain the UI pixel parameters corresponding to the UI element, and then calculate the target UI width and height corresponding to the UI element based on the UI pixel parameters and the resolution; determine whether the target UI width and height corresponding to the UI element exceeds the upper limit of the UI size of the UI element; if it exceeds the upper limit of the UI size, adjust the UI elements of the interface layout within the Android client application to the upper limit of the UI size; if it does not exceed the upper limit of the UI size, adjust the UI elements of the interface layout within the Android client application to the target UI width and height.

[0068] An embodiment of the present application also provides a storage medium, which is arranged in an electronic device and includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the interface display adaptation method based on the Android client of this embodiment.

[0069] An embodiment of the present application also provides an electronic device, including a memory and a processor, the memory is used to store information including program instructions, the processor is used to control the execution of the program instructions, and when the program instructions are loaded and executed by the processor, the steps of the interface display adaptation method based on the Android client of this embodiment are implemented.

[0070] In summary, the embodiment of the present application provides an interface display adaptation method and device based on an Android client, by obtaining the device parameters (screen size, resolution, physical pixel density) and personalized display parameters (current density scale factor, font scale factor and display mode) of the current device, and then adjusting the interface layout in the Android client application according to the device parameters and personalized display parameters of the current device, so as to load the adjusted in-application interface layout and display. Such a scheme can take into account the actual parameters of the device (such as screen size, resolution, pixel density, etc.) and the user's personalized preferences (such as vision conditions, ambient brightness, etc., reflected by font scale factor and display mode) to perform dynamic adjustments, thereby achieving display adaptation on different devices and different user settings, effectively solving the adaptability problems of multiple devices and user personalization (especially for users who need large font display), and improving user experience.

[0071] Based on the physical pixel density of the current device and the Android application development benchmark pixel density, the reference density scale factor is calculated (the Android application development benchmark pixel density is obtained, and the ratio of the physical pixel density to the benchmark pixel density is calculated as the reference density scale factor). Based on the reference density scale factor and the current density scale factor, the display scale factor is calculated (the ratio of the current density scale factor to the reference density scale factor is calculated as the display scale factor). The display scale factor thus calculated can play a key role in adjusting UI elements, taking into account not only the parameters of different devices, but also the user's personalized display mode (such as the zoom mode), so that UI elements can be effectively adapted on different devices and under different user preferences. Refined adaptation adjustments are made for UI elements and font elements respectively, and upper limits are set to avoid problems such as overlap and incomplete display between different elements, effectively completing display adaptation under various devices and user preferences.

[0072] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. An interface display adaptation method based on an Android client, characterized in that: include: Obtain device parameters and personalized display parameters of the current device, where the device parameters include screen size, resolution, and physical pixel density, and the personalized display parameters include current density scale factor, font scale factor, and display mode; Adjust the interface layout within the Android client application according to the device parameters and personalized display parameters of the current device; Load the adjusted in-app interface layout and display it.

2. The interface display adaptation method based on Android client according to claim 1, characterized in that: Adjust the interface layout in the Android client application according to the device parameters and personalized display parameters of the current device, including: Calculate the reference density scale factor based on the physical pixel density of the current device and the Android application development benchmark pixel density; Calculate a display scale factor based on the reference density scale factor and the current density scale factor; Adjust the interface layout within the Android client application based on screen size, resolution, reference density scale factor, display scale factor, font scale factor, and display mode.

3. The interface display adaptation method based on Android client according to claim 2, characterized in that: Based on the physical pixel density of the current device and the Android application development benchmark pixel density, calculate the reference density scale factor, including: Get the benchmark pixel density for Android app development; Calculate the ratio of the physical pixel density to the benchmark pixel density as the reference density scaling factor.

4. The interface display adaptation method based on Android client according to claim 2, characterized in that: Based on the reference density scale factor and the current density scale factor, the display scale factor is calculated, including: Calculate the ratio of the current density scale factor to the reference density scale factor as the display scale factor.

5. The interface display adaptation method based on Android client according to claim 2, characterized in that: Adjust the interface layout within the Android client application based on screen size, resolution, reference density scale factor, display scale factor, font scale factor, and display mode, including: For text elements in the interface layout of Android client applications: adjust the text elements in the interface layout of Android client applications based on screen size, resolution, reference density scale factor, font scale factor and scale-independent pixels of text elements; For UI elements of the interface layout in Android client applications: adjust the UI elements of the interface layout in Android client applications based on screen size, resolution, reference density scale factor, display scale factor and density-independent pixels of UI elements; Enable the corresponding display mode in the Android client application based on the display mode.

6. The interface display adaptation method based on Android client according to claim 5, characterized in that: Adjust text elements in the interface layout of the Android client application based on screen size, resolution, reference density scale factor, font scale factor, and scale-independent pixels of text elements, including: Determine the upper limit of the font size of text elements based on the width of the screen size; The scaling-independent pixels of the text element are multiplied by the reference density scale factor and the font scale factor to obtain the font pixel parameters corresponding to the text element, and then the target font width and height corresponding to the text element are calculated based on the font pixel parameters and the resolution; Determine whether the width and height of the target font corresponding to the text element exceeds the upper limit of the font size of the text element; If the font size exceeds the upper limit, adjust the text elements of the interface layout in the Android client application to the upper limit of the font size; If the upper limit of the font size is not exceeded, adjust the text elements of the interface layout in the Android client application to the target font width and height.

7. The interface display adaptation method based on Android client according to claim 5, characterized in that: Adjust the UI elements of the interface layout within the Android client application based on the screen size, resolution, reference density scale factor, display scale factor, and density-independent pixels of the UI elements, including: Determine the upper limit of UI size of UI elements based on the width of the screen size; Multiply the density-independent pixels of the UI element by the reference density scale factor and the display scale factor to obtain the UI pixel parameters corresponding to the UI element, and then calculate the target UI width and height corresponding to the UI element based on the UI pixel parameters and resolution; Determine whether the width and height of the target UI corresponding to the UI element exceeds the UI size upper limit of the UI element; If the UI size exceeds the upper limit, adjust the UI elements of the interface layout in the Android client application to the upper limit of the UI size; If the UI size limit is not exceeded, adjust the UI elements of the interface layout in the Android client application to the target UI width and height.

8. An interface display adaptation device based on an Android client, characterized in that: include: A parameter acquisition unit, used to acquire device parameters and personalized display parameters of the current device, wherein the device parameters include screen size, resolution, and physical pixel density, and the personalized display parameters include current density scaling factor, font scaling factor, and display mode; An interface adjustment unit, used to adjust the interface layout within the Android client application according to the device parameters and personalized display parameters of the current device; The interface display unit is used to load and display the adjusted in-application interface layout.

9. A storage medium, characterized in that: The storage medium is set in the device, including a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the interface display adaptation method based on the Android client according to any one of claims 1 to 7.

10. An electronic device comprising a memory and a processor, wherein the memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions, characterized in that: When the program instructions are loaded and executed by the processor, the steps of the interface display adaptation method based on the Android client described in any one of claims 1 to 7 are implemented.