CN108427546B - Full screen adaptation method of display device, display device and storage medium - Google Patents
Full screen adaptation method of display device, display device and storage medium Download PDFInfo
- Publication number
- CN108427546B CN108427546B CN201810414337.5A CN201810414337A CN108427546B CN 108427546 B CN108427546 B CN 108427546B CN 201810414337 A CN201810414337 A CN 201810414337A CN 108427546 B CN108427546 B CN 108427546B
- Authority
- CN
- China
- Prior art keywords
- screen
- display device
- file
- page
- full
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/14—Digital output to display device ; Cooperation and interconnection of the display device with other functional units
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Controls And Circuits For Display Device (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The invention discloses a full-screen adaptation method of a display device, which comprises the following steps: when a layout file is obtained, converting a unit of a page file in the layout file into a length unit; acquiring information of page files in the converted layout files, and calculating the initialized display proportion of the page files; when screen parameter information of a display device is read, determining the proportion to be displayed of the page file according to the screen parameter information of the display device, and carrying out full-screen adaptation according to the proportion to be displayed of the page file. The invention also discloses a display device and a readable medium. The method solves the problem of writing layout files adapting to different screen resolutions or creating different screen sizes at one time, and can quickly realize the adaptation of the whole screen.
Description
Technical Field
The present invention relates to the field of display device applications, and in particular, to a full-screen adaptation method for a display device, and a computer-readable storage medium.
Background
Due to the severe fragmentation of Android, screen adaptation has always been a relatively painful problem in development. In order to achieve the optimal visual effect, more resources are always needed to be spent for adaptation in the development process. The current common solutions are:
1. the official adaptation scheme dp is a unit specific in Android development. Unlike px, dp is a unit based on screen pixel density. On a screen with low density, 1dp may be 1px, but on a screen with high density, 1dp may be 4 px. When writing layout xml, if the length and width of a control are specified by dp, it can be ensured that the absolute size of the control is approximately equivalent to the absolute size of the control under screens with various sizes and resolutions. That is, the size of the control we actually see is almost the same, whether under pad or under a large-and-small-screen handset.
2. Resource directory name-under res directory, suffixes such as '1920 × 1080' can be added to each resource directory to adapt to different screens, so that different layouts can be provided for different screens, and even two sets of completely different layout styles can be provided for pad and mobile phone.
In the face of the screen size and resolution of the Firework in the market, the scheme that the Android adapts based on dp and res directory names cannot meet the requirement of writing full-screen adaptation at one time.
Disclosure of Invention
The invention mainly aims to provide a full-screen adaptation method of a display device, aiming at solving the problem that the full-screen adaptation can be quickly realized by writing layout files adapting to different screen resolutions or creating different screen sizes at one time.
In order to achieve the above object, the present invention provides a full-screen adapting method of a display device, including:
when a layout file is obtained, converting a unit of a page file in the layout file into a length unit;
acquiring information of page files in the converted layout files, and calculating the initialized display proportion of the page files;
when screen parameter information of a display device is read, determining the proportion to be displayed of the page file according to the screen parameter information of the display device, and carrying out full-screen adaptation according to the proportion to be displayed of the page file.
Preferably, the step of converting the unit of the page file in the layout file into the unit of length after the layout file is obtained includes:
when a drawn layout file is obtained, obtaining a pixel unit of a page file in the layout file, wherein the drawn page file in the layout file is drawn according to the same size proportion and the same pixel unit;
and converting the pixel unit of the page file into a length unit according to a prestored unit function conversion formula.
Preferably, the step of obtaining the information of the page files in the converted layout file and calculating the display scale of the page files includes:
when a plurality of page files are obtained in the layout file, judging whether the size information of the plurality of page files is the same;
and when the sizes of a plurality of page files in the layout file are the same, calculating the initialized display ratio between the resolution and the size information of the page files according to the resolution and the size information of the page files and the function of the pre-stored generic variable and the screen direction.
Preferably, when the sizes of the plurality of page files in the layout file are the same, the step of calculating the initialized display ratio between the resolution and the size information of the page files according to the resolution and the size information of the page files, and a function of a pre-stored generic variable and a screen direction further includes:
and when the size information of a plurality of page files in the layout file is different, calculating the initialized display ratio between the resolution and the size information of each page file according to the resolution and the size information of each page file.
Preferably, when the screen parameter information of the display device is read, the to-be-displayed proportion of the pagefile is determined according to the screen parameter information of the display device, and the step of performing full-screen adaptation according to the to-be-displayed proportion of the pagefile comprises the following steps:
when parameter information of a screen is read, acquiring the resolution and the size of the screen;
when the page file is displayed on the screen, the ratio to be displayed of the page file is adjusted and determined according to the resolution and the size of the screen of the display device, and full-screen adaptation is performed according to the ratio to be displayed of the page file.
Preferably, when the pagefile is displayed on the screen, the step of adjusting and determining the ratio of the pagefile to be displayed according to the resolution and the size of the screen of the display device, and the step of performing full-screen adaptation according to the ratio of the pagefile to be displayed comprises the following steps:
when the initialized display proportion of the page file is adapted to the parameter information of the screen, converting the length unit of the initialized display proportion of the page file into a pixel unit by using a unit function conversion formula;
and dynamically adjusting the pixel unit of the initialized display proportion according to the resolution of the screen of the display device, determining the proportion to be displayed of the page file when the size of the screen of the display device is the same as that of the display proportion, and carrying out full-screen adaptation according to the proportion to be displayed of the page file.
Further, to achieve the above object, the present invention also provides a display device including: the full-screen adaptation program of the display device realizes the steps of the full-screen adaptation method of the display device according to the invention when being executed by the processor.
Further, to achieve the above object, the present invention also provides a computer readable storage medium having stored thereon a full screen adaptation program of a display apparatus, which when executed by a processor, implements the steps of the full screen adaptation method of the display apparatus as described above.
According to the full-screen adaptation method of the display device, the display device and the readable medium, when the layout file is obtained, the unit of the page file in the layout file is converted into the length unit; acquiring information of page files in the converted layout files, and calculating the initialized display proportion of the page files; when the screen parameter information of the display device is read, the ratio to be displayed of the page file is determined according to the screen parameter information of the display device, full-screen adaptation is performed according to the ratio to be displayed of the page file, the fact that layout files which adapt to different screen resolutions or create different screen sizes are compiled once is achieved, and full-screen adaptation can be achieved rapidly.
Drawings
Fig. 1 is a schematic structural diagram of a display device according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a full-screen adapting method of a display device according to a first embodiment of the present invention;
FIG. 3 is a flowchart illustrating a full-screen adapting method of a display device according to a second embodiment of the present invention;
FIG. 4 is a flowchart illustrating a full-screen adapting method of a display device according to a third embodiment of the present invention;
FIG. 5 is a flowchart illustrating a full-screen adapting method of a display device according to a fourth embodiment of the present invention;
FIG. 6 is a flowchart illustrating a fifth embodiment of a full-screen adapting method for a display device according to the present invention;
FIG. 7 is a flowchart illustrating a sixth embodiment of a full-screen adaptation method for a display device according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The main solution of the embodiment of the invention is as follows: when a layout file is obtained, converting a unit of a page file in the layout file into a length unit; acquiring information of page files in the converted layout files, and calculating the initialized display proportion of the page files; when screen parameter information of a display device is read, determining the proportion to be displayed of the page file according to the screen parameter information of the display device, and carrying out full-screen adaptation according to the proportion to be displayed of the page file.
In the prior art, in the face of the screen size and resolution of the Firework in the market, the scheme for Android to adapt based on dp and res directory names cannot meet the requirement of compiling full-screen adaptation at one time.
The invention provides a solution, which enables the layout files which are adapted to different screen resolutions or different screen sizes to be created by writing once, and can quickly realize the adaptation of the full screen in the code.
As shown in fig. 1, fig. 1 is a schematic structural diagram of a display device according to an embodiment of the present invention.
The terminal of the embodiment of the invention can be a display device such as a mobile phone, a tablet computer, a computer and the like.
As shown in fig. 1, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Optionally, the terminal may further include a camera, a Radio Frequency (RF) circuit, a sensor, an audio circuit, a WiFi module, and the like. Such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display screen according to the brightness of ambient light, and a proximity sensor that may turn off the display screen and/or the backlight when the mobile terminal is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), detect the magnitude and direction of gravity when the mobile terminal is stationary, and can be used for applications (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer and tapping) and the like for recognizing the attitude of the mobile terminal; of course, the mobile terminal may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which are not described herein again.
Those skilled in the art will appreciate that the terminal structure shown in fig. 1 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein a full screen adaptation program of an operating system, a network communication module, a user interface module, and a display device.
In the terminal shown in fig. 1, the network interface 1004 is mainly used for connecting to a backend server and performing data communication with the backend server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be configured to call a full screen adaptation program of the display device stored in the memory 1005 and perform the following operations:
when a layout file is obtained, converting a unit of a page file in the layout file into a length unit;
acquiring information of page files in the converted layout files, and calculating the initialized display proportion of the page files;
when screen parameter information of a display device is read, determining the proportion to be displayed of the page file according to the screen parameter information of the display device, and carrying out full-screen adaptation according to the proportion to be displayed of the page file.
Further, the processor 1001 may call a full screen adaptation program of the display apparatus stored in the memory 1005, and also perform the following operations:
when a drawn layout file is obtained, obtaining a pixel unit of a page file in the layout file, wherein the drawn page file in the layout file is drawn according to the same size proportion and the same pixel unit;
and converting the pixel unit of the page file into a length unit according to a prestored unit function conversion formula.
Further, the processor 1001 may call a full screen adaptation program of the display apparatus stored in the memory 1005, and also perform the following operations:
when a plurality of page files are obtained in the layout file, judging whether the size information of the plurality of page files is the same;
and when the sizes of a plurality of page files in the layout file are the same, calculating the initialized display ratio between the resolution and the size information of the page files according to the resolution and the size information of the page files and the function of the pre-stored generic variable and the screen direction.
Further, the processor 1001 may call a full screen adaptation program of the display apparatus stored in the memory 1005, and also perform the following operations:
and when the size information of a plurality of page files in the layout file is different, calculating the initialized display ratio between the resolution and the size information of each page file according to the resolution and the size information of each page file.
Further, the processor 1001 may call a full screen adaptation program of the display apparatus stored in the memory 1005, and also perform the following operations:
when parameter information of a screen is read, acquiring the resolution and the size of the screen;
when the page file is displayed on the screen, the ratio to be displayed of the page file is adjusted and determined according to the resolution and the size of the screen of the display device, and full-screen adaptation is performed according to the ratio to be displayed of the page file.
Further, the processor 1001 may call a full screen adaptation program of the display apparatus stored in the memory 1005, and also perform the following operations:
when the initialized display proportion of the page file is adapted to the parameter information of the screen, converting the length unit of the initialized display proportion of the page file into a pixel unit by using a unit function conversion formula;
and dynamically adjusting the pixel unit of the initialized display proportion according to the resolution of the screen of the display device, determining the proportion to be displayed of the page file when the size of the screen of the display device is the same as that of the display proportion, and carrying out full-screen adaptation according to the proportion to be displayed of the page file.
Referring to fig. 2, the present invention is a first embodiment of a full-screen adaptation method of a display device, including:
step S10, when a layout file is obtained, converting the unit of the page file in the layout file into a length unit;
the method comprises the steps of obtaining a layout file, wherein the layout file comprises different page files, the page files in the layout file are drawn by a developer completely according to the size of a design draft during drawing, and the page files are written by using px which is the same as the design draft during drawing. And converting the page file written by px in the acquired layout file into pt units by using an applyDimension function in TypedValue. And according to the pre-stored preview parameters, when the page file is adapted to the preview parameters, dynamically converting the unit of the code in the page file into px unit by using TypedValue. Drawing a page in real-time preview is an important link. For example, taking a 1334 x 750 blueprint as an example, to implement the same preview function as when rendering normally, a display parameter of 1334 pounds in length and 750 pounds in width is created as a preview, scaled to about 21.5 inches ((sqrt (1334^2+750^ 2))/72). And adapting to the preview parameters during previewing, adjusting the resolution and the size of the page file according to the previewing parameter information, and adapting to the preview parameters according to the adjusted page file. And converting when the Android calculates the length. The closing of the system for length calculation is an applyDimension function in TypedValue, and the incoming unit and value calculate it as the corresponding px value. All attributes of the DisplayMetrics are public and can be modified without reflection. Although the DisplayMetrics in Activity and the DisplayMetrics in Application are not an example, all values are the same, and making changes in Application will also affect all Activities. Changes in Configuration such as horizontal and vertical screen switching can cause recalculation and restoration of the DisplayMetrics, and need to be reprocessed. Px, dp and sp are commonly used units in normal times, pt, in and mm are hardly seen, and other commonly used units can be just not influenced by hands under the uncommon units. The original meaning of pt is length unit pound, and modifying metrics. xdpi according to the current screen and the size of the design drawing can realize redefining the unit of pt into the relative length unit which is required by us, so that px/screen width px which is actually corresponding to 1pt calculated after modification is 1 px/design drawing width px.
Step S20, acquiring the information of the page file in the converted layout file, and calculating the display scale of the page file initialization;
when the px unit of the page file is converted into the pt unit, there is a possibility that the size of the page file may be changed. The notion of pt is a length unit pound, which can be redefined to the relative length unit we need by modifying metrics. xdpi based on the current screen and blueprint dimensions. And judging whether the size of the page file in the layout file is changed or not, and when the size of the page file in the layout file is not changed, drawing the size of the page file in the layout file according to the size of the design drawing completely. It is processed in onCreate in application and onConfigurationChanged to calculate an initial display ratio between the resolution and size of the pagefile. When the size of the page file in the layout file changes, processing is required in the onCreate of each activity to calculate the initial display ratio between the resolution and the size of each page file. There is no need to process onconfigurechanged in Activity because the configuration change page is regenerated.
And step S30, when the screen parameter information of the display device is read, carrying out full-screen adaptation according to the information of the page file and the parameter information of the screen.
When adapting the screen of the display device according to the information of the page file, the size and resolution of each display device screen may be different, and the resolution and size of the current display device screen are read. Reading the resolution and the size of a screen of a display device, adjusting the display proportion of a page file according to the resolution and the size of the screen of the display device, converting a pt unit into a px unit when a code of the display proportion in the page file is adapted to a parameter of the screen, and using TypedValue. And dynamically adjusting the initial display proportion of the page file according to the resolution and the size of the screen of the display device, thereby determining the proportion of the page file to be displayed in the display device and meeting the adaptation requirement of the full screen of the display device.
In this embodiment, a unit of a page file in an acquired layout file is converted into a length unit, page file information after the unit conversion is acquired, an initialization display proportion of the page file is calculated according to the page file information, and when screen parameters of a display device are read, the initialization display proportion of the page file is adjusted according to the screen parameters of the display device, so that the proportion of the page file to be displayed is determined, and full-screen adaptation of the display device is performed. The layout file written once is adaptive to different screen resolutions or different screen sizes are created, and the full-screen adaptation is realized quickly.
Further, referring to fig. 3, fig. 3 is a second embodiment of the full-screen adapting method of the display device according to the present invention, and based on the embodiment shown in fig. 2, the step S10 includes:
step S11, when a drawn layout file is obtained, obtaining the pixel unit of the page file in the layout file, wherein the page file in the drawn layout file is drawn according to the same size proportion and pixel unit;
and step S12, converting the pixel unit of the page file into a length unit according to a prestored unit function conversion formula.
The method comprises the steps of obtaining a layout file, wherein the layout file comprises different page files, the page files are drawn by a developer completely according to the size of a design draft when the developer draws, and the developer writes the layout by using px when the page files are drawn. And acquiring the resolution and the size of the page file in the layout file and the unit of the page file. And converting the page file written by px in the acquired layout file into pt units by using an applyDimension function in TypedValue. The closing of the system for length calculation is an applyDimension function in TypedValue, and the incoming unit and value calculate it as the corresponding px value. Although the DisplayMetrics in Activity and the DisplayMetrics in Application are not an example, all values are the same, and making changes in Application will also affect all Activities. Changes in Configuration such as horizontal and vertical screen switching can cause recalculation and restoration of the DisplayMetrics, and need to be reprocessed. Px, dp and sp are commonly used units in normal times, pt, in and mm are hardly seen, and other commonly used units can be just not influenced by hands under the uncommon units. The notion of pt is a length unit pound, which can be redefined to the relative length unit we need by modifying metrics. xdpi based on the current screen and blueprint dimensions.
In the present embodiment, upon receiving a drawn layout file, a pixel unit of a page file in the layout file is acquired, and the pixel unit of the page file is converted into a length unit using a unit conversion function. Redefining pt to the relative length unit we need can be achieved so that 1pt calculated after modification actually corresponds to px/screen width px/plan view width px as 1 px/plan view width px.
Referring to fig. 4, fig. 4 is a first embodiment of a full-screen adapting method of a display device according to the present invention, and based on the embodiment shown in fig. 2, the step S20 includes:
step S21, when multiple page files are obtained from the layout file, determining whether the size information of the multiple page files is the same;
step S22, when the sizes of the plurality of page files in the layout file are the same, calculating an initialized display ratio between the resolution and the size information of the page files according to the resolution and the size information of the page files, and according to a function of a pre-stored generic variable and a screen direction.
When a plurality of page files exist in the received layout file, the closing of the page files in length calculation is an applyDimension function in TypedValue, and the input unit and value calculate the closing as a corresponding px value. The value of DisplayMetrics, which can be obtained from the source code, comes from mContext. Although the DisplayMetrics in the Activity and the DisplayMetrics in the Application are not an example, all values are the same, and since changing in the Application also affects all activities, it is determined whether the sizes of the plurality of page files in the layout file have changed. When the pagefile in the layout file is not changed, the size of the pagefile is the same. And calculating an initial display ratio between the resolution and the size of the page file in onCreate and onConfigurationChanged in application according to the resolution and the size of the page file.
In this embodiment, when there are a plurality of page files in the layout file, it is determined whether the size information of the plurality of page files is the same. When the size information of the plurality of page files is the same, an initial display ratio between the page file size information and the resolution is calculated according to the size information and the resolution of the page files. And calculating the ratio relation between the size information and the resolution of the page file according to the size information and the resolution of the page file, and adjusting the initial display scale of the page file according to the size information and the resolution.
Referring to fig. 5, fig. 5 is a fourth embodiment of the full-screen adapting method of the display device according to the present invention, and based on the embodiment shown in fig. 4, the step S22 further includes:
step S23, when the size information of the plurality of page files in the layout file is different, calculating an initialized display ratio between the resolution and the size information of each page file according to the resolution and the size information of each page file.
When the closing of the page file for length calculation is the applyDimension function in TypedValue, the incoming unit and value calculate it as the corresponding px value. The value of DisplayMetrics, which can be obtained from the source code, is from mContext, getresources (), getDisplayMetrics (), and mContext is Activity. The DisplayMetrics in Activity and Application are not an example, but all values are the same. Since changes made in Application also affect all activities, there is a possibility that the sizes of a plurality of page files in the layout file may change, and the resolution and size of each page file are acquired. And calculating the initialized display proportion between the resolution and the size of each page file in the onCreate of each activity according to the acquired resolution and size of each page file. There is no need to process onconfigurechanged in Activity because the configuration change page is regenerated.
In this embodiment, when the size information of the page files in the layout file is changed in the process of converting the unit, the initialized display scale between the size information and the resolution of each page file is calculated. According to the ratio relationship between the size information and the resolution of each pagefile, the initialized display scale of each pagefile can be adjusted according to the size and the resolution.
Referring to fig. 6, fig. 6 is a fifth embodiment of the full-screen adapting method of the display device according to the present invention, and based on the embodiment shown in fig. 2, the step S30 includes:
step S31, when the parameter information of the screen is read, the resolution and the size of the screen are obtained
Step S32, when the page file is displayed on the screen, the ratio to be displayed of the page file is adjusted and determined according to the resolution and the size of the screen of the display device, and full-screen adaptation is performed according to the ratio to be displayed of the page file.
And when the parameter information of the screen of the display device is read, acquiring the resolution and the size of the screen of the display device. The parameter information of each display device is different, for example, the mobile phones of the same brand have different models. The mobile phone screens of different models are different in resolution and size, some mobile phone screens are large in size, some mobile phone screens are small in size, other mobile phone screens are high in resolution, and some mobile phone screens are low in resolution. When the page file is displayed and matched on the screen of the current display device, the ratio to be displayed of the page file is adjusted and determined according to the resolution and the size of the screen of the current display device, so that the full-screen matching of the display device is carried out according to the ratio to be displayed of the page file.
In the present embodiment, when the screen parameters of the display device are read, the screen resolution and the size information of the display device are acquired. When the page file is displayed on the screen of the display device, the ratio to be displayed of the displayed page file is adjusted and determined according to the screen resolution and the size information of the display device, so that full-screen adaptation of the display device is carried out. And adjusting and determining the ratio to be displayed of the page file according to the screen resolution and the size information of the display device, and carrying out full-screen adaptation on the display device to achieve the purpose of compiling the layout file at one time.
Referring to fig. 7, fig. 7 is a sixth embodiment of the full-screen adapting method of the display device according to the present invention, based on the embodiment shown in fig. 6, where the step S32 includes:
step S321, when the initialized display proportion of the page file is adapted to the parameter information of the screen, converting the length unit of the initialized display proportion of the page file into a pixel unit by using a unit function conversion formula;
step S322, dynamically adjusting the pixel unit of the initialized display proportion according to the resolution of the screen of the display device, determining the proportion to be displayed of the page file when the size of the screen of the display device is the same as that of the display proportion, and carrying out full-screen adaptation according to the proportion to be displayed of the page file.
When the information of the page file is adapted to the screen parameter information of the display device, and the code of the initialized display scale of the page file is adapted to the resolution and the size information of the screen of the display device, converting the unit of the display scale code of the page file into px unit by using TypedValue. Initialization of the page file shows that the scale code changes DisplayMetrics in the onCreate and onconfigurechanged at Application in px units. When the page file is displayed on the display screen of the display device, the resolution ratio of the display scale of the page file is adjusted according to the resolution ratio of the display screen of the display device, so that the display scale of the page file is enlarged or reduced. And when the size information in the display scale of the page file is the same as the screen size of the display device in the process of zooming in or zooming out, determining the to-be-displayed scale of the page file. And carrying out adaptation on the full screen of the display device according to the to-be-displayed proportion of the page file, thereby achieving full-screen adaptation of the display device.
In the present embodiment, when the display scale of the pagefile is adapted to the screen parameters of the display device, the code of the display scale of the pagefile is converted into a pixel unit. Therefore, the resolution of the display proportion of the page file is adjusted according to the screen resolution of the display device, the proportion to be displayed of the page file is determined according to the screen size of the display device to carry out full-screen adaptation of the display device, so that the problem of compiling and adapting to different screen resolutions or creating layout files with different screen sizes at one time is solved, and the full-screen adaptation can be quickly realized in codes
In addition, an embodiment of the present invention further provides a display apparatus, where a full-screen adaptation program of the display apparatus is stored on a computer-readable storage medium, and the display apparatus includes: the full-screen adaptation program of the display device comprises a memory, a processor and a full-screen adaptation program of the display device, wherein the full-screen adaptation program of the display device is stored in the memory and can run on the processor, and when being executed by the processor, the steps of the full-screen adaptation method of the display device are realized.
In addition, an embodiment of the present invention further provides a display apparatus, where the computer readable storage medium stores a full-screen adaptation program of the display apparatus, and the full-screen adaptation program of the display apparatus, when executed by a processor, implements the steps of the full-screen adaptation method of the display apparatus according to the above embodiment.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (7)
1. A full-screen adaptation method of a display device is characterized by comprising the following steps:
when a layout file is obtained, converting a unit of a page file in the layout file into a length unit;
acquiring information of page files in the converted layout files, and calculating the initialized display proportion of the page files;
when screen parameter information of a display device is read, determining the ratio to be displayed of the page file according to the screen parameter information of the display device, and carrying out full-screen adaptation according to the ratio to be displayed of the page file;
the step of converting the unit of the page file in the layout file into the length unit after the layout file is obtained includes:
when a drawn layout file is obtained, obtaining a pixel unit of a page file in the layout file, wherein the drawn page file in the layout file is drawn according to the same size proportion and the same pixel unit;
and converting the pixel unit of the page file into a length unit according to a prestored unit function conversion formula.
2. The full-screen adaptation method of a display device according to claim 1, wherein the step of obtaining information of the converted page file in the layout file and calculating the display scale of the page file comprises:
when a plurality of page files are obtained in the layout file, judging whether the size information of the plurality of page files is the same;
and when the sizes of a plurality of page files in the layout file are the same, calculating the initialized display ratio between the resolution and the size information of the page files according to the resolution and the size information of the page files and the function of the pre-stored generic variable and the screen direction.
3. The full-screen adaptation method of a display device according to claim 2, wherein the step of calculating an initialized display ratio between the resolution and size information of the pagefile according to the resolution and size information of the pagefile, a function of a pre-stored generic variable and a screen direction, when sizes of a plurality of pagefiles in the layout file are the same, further comprises:
and when the size information of a plurality of page files in the layout file is different, calculating the initialized display ratio between the resolution and the size information of each page file according to the resolution and the size information of each page file.
4. The full-screen adaptation method of the display device according to any one of claims 2 to 3, wherein when screen parameter information of the display device is read, the to-be-displayed proportion of the pagefile is determined according to the screen parameter information of the display device, and the step of performing full-screen adaptation according to the to-be-displayed proportion of the pagefile comprises the following steps:
when parameter information of a screen is read, acquiring the resolution and the size of the screen;
when the page file is displayed on the screen, the ratio to be displayed of the page file is adjusted and determined according to the resolution and the size of the screen of the display device, and full-screen adaptation is performed according to the ratio to be displayed of the page file.
5. The full-screen adaptation method of the display device according to claim 4, wherein when the pagefile is displayed on the screen, the to-be-displayed ratio of the pagefile is adjusted and determined according to the resolution and the size of the screen of the display device, and the step of performing full-screen adaptation according to the to-be-displayed ratio of the pagefile comprises:
when the initialized display proportion of the page file is adapted to the parameter information of the screen, converting the length unit of the initialized display proportion of the page file into a pixel unit by using a unit function conversion formula;
and dynamically adjusting the pixel unit of the initialized display proportion according to the resolution of the screen of the display device, determining the proportion to be displayed of the page file when the size of the screen of the display device is the same as that of the display proportion, and carrying out full-screen adaptation according to the proportion to be displayed of the page file.
6. A display device, characterized in that the display device comprises: memory, a processor and a full screen adaptation program of a display device stored on the memory and executable on the processor, the full screen adaptation program of the display device implementing the steps of the full screen adaptation method of a display device according to any one of claims 1 to 5 when executed by the processor.
7. A computer-readable storage medium, having stored thereon a full-screen adaptation program of a display apparatus, which when executed by a processor, performs the steps of the full-screen adaptation method of the display apparatus according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810414337.5A CN108427546B (en) | 2018-05-03 | 2018-05-03 | Full screen adaptation method of display device, display device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810414337.5A CN108427546B (en) | 2018-05-03 | 2018-05-03 | Full screen adaptation method of display device, display device and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108427546A CN108427546A (en) | 2018-08-21 |
CN108427546B true CN108427546B (en) | 2022-03-08 |
Family
ID=63162343
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810414337.5A Active CN108427546B (en) | 2018-05-03 | 2018-05-03 | Full screen adaptation method of display device, display device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108427546B (en) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112988561B (en) * | 2019-12-18 | 2023-09-08 | 腾讯科技(深圳)有限公司 | Method, device, server and storage medium for detecting display configuration code |
CN113051010B (en) * | 2019-12-28 | 2023-04-28 | Oppo(重庆)智能科技有限公司 | Application picture adjustment method and related device in wearable equipment |
CN111443974A (en) * | 2020-03-26 | 2020-07-24 | 中国农业银行股份有限公司 | Android device screen adapting method, related device and readable storage medium |
CN113829996B (en) * | 2020-06-24 | 2023-09-08 | 逸驾智能科技有限公司 | Display method, electronic device, and computer-readable storage medium |
CN112099887B (en) * | 2020-08-21 | 2021-12-17 | 完美世界(重庆)互动科技有限公司 | Interface adjusting method and device, computer equipment and computer readable storage medium |
CN116009802A (en) * | 2021-10-22 | 2023-04-25 | 华为技术有限公司 | Page display method, electronic device and computer readable storage medium |
CN114416230A (en) * | 2021-12-20 | 2022-04-29 | 青岛海尔科技有限公司 | Screen-adaptive component display method and system |
CN114647393A (en) * | 2022-03-04 | 2022-06-21 | 北京达佳互联信息技术有限公司 | Screen adaptation method, device, server and storage medium |
CN115048172A (en) * | 2022-06-17 | 2022-09-13 | 北京奇艺世纪科技有限公司 | Page adaptation method and device, electronic equipment and storage medium |
CN115080027B (en) * | 2022-08-24 | 2023-01-06 | 深圳市信润富联数字科技有限公司 | Web page automatic adaptation method, device, equipment and storage medium |
Family Cites Families (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4742447A (en) * | 1986-01-16 | 1988-05-03 | International Business Machines Corporation | Method to control I/O accesses in a multi-tasking virtual memory virtual machine type data processing system |
CA2168641C (en) * | 1995-02-03 | 2000-03-28 | Tetsuya Kitamura | Image information encoding/decoding system |
JPH09245035A (en) * | 1996-03-12 | 1997-09-19 | Toshiba Corp | Document management device |
US20070078670A1 (en) * | 2005-09-30 | 2007-04-05 | Dave Kushal B | Selecting high quality reviews for display |
KR101987424B1 (en) * | 2012-11-29 | 2019-06-11 | 삼성디스플레이 주식회사 | Pixel, diplay device comprising the pixel and driving method of the diplay device |
CN103049430A (en) * | 2012-12-27 | 2013-04-17 | 南京新与力文化传播有限公司 | Page display method based on IDF (interactive document format) files |
CN104050947A (en) * | 2013-03-15 | 2014-09-17 | 联想(北京)有限公司 | Display control method and electronic device |
KR20150099297A (en) * | 2014-02-21 | 2015-08-31 | 삼성전자주식회사 | Method and apparatus for displaying screen on electronic devices |
CN105791979A (en) * | 2014-12-26 | 2016-07-20 | 深圳Tcl数字技术有限公司 | Video file processing method and display device |
CN105630746A (en) * | 2015-12-21 | 2016-06-01 | 华为技术有限公司 | Page displaying method and terminal equipment |
CN105912336A (en) * | 2016-04-11 | 2016-08-31 | 江苏中威科技软件系统有限公司 | Multi-screen adaptive method for mobile terminal front-end development |
CN106502659B (en) * | 2016-10-14 | 2019-05-17 | 武汉斗鱼网络科技有限公司 | A kind of layout method and system of mobile device webpage single-page |
CN107220050A (en) * | 2017-05-25 | 2017-09-29 | 努比亚技术有限公司 | Adaptive display method, terminal and computer-readable recording medium |
CN107733876A (en) * | 2017-09-26 | 2018-02-23 | 惠州Tcl移动通信有限公司 | A kind of stream media caption display methods, mobile terminal and storage device |
-
2018
- 2018-05-03 CN CN201810414337.5A patent/CN108427546B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN108427546A (en) | 2018-08-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108427546B (en) | Full screen adaptation method of display device, display device and storage medium | |
CN109725901B (en) | Front-end code development method, device, equipment and computer storage medium | |
CN109460233B (en) | Method, device, terminal equipment and medium for updating native interface display of page | |
US20170116644A1 (en) | Providing advertisements in an augmented reality environment | |
CN110516218B (en) | Method for generating table, terminal and computer readable storage medium | |
CN109947771B (en) | File type conversion method, apparatus, device and computer readable storage medium | |
CN110035181B (en) | Method and terminal for setting theme of quick application card | |
KR102354016B1 (en) | Method for changing the size of contents displayed on display and electronic device thereof | |
WO2015043442A1 (en) | Method, device and mobile terminal for text-to-speech processing | |
CN113050941A (en) | Front-end page generation method, device, equipment and computer readable storage medium | |
CN112230923A (en) | User interface rendering method, user interface rendering device and server | |
CN112068919A (en) | Webpage screen capture processing method and device, electronic equipment and storage medium | |
CN110750664A (en) | Picture display method and device | |
CN113821417A (en) | Lamp effect adaptation display processing method, intelligent terminal and storage medium | |
CN111367518A (en) | Page layout method and device, computing equipment and computer storage medium | |
US20150199329A1 (en) | Text display method and apparatus of electronic device | |
CN103488508A (en) | Browser working method, browser and terminal equipment | |
CN112948045A (en) | Picture display method, device, equipment and computer readable storage medium | |
US20170346672A1 (en) | Information processing method and electronic device | |
CN109857503B (en) | Page interaction effect self-adaption method and device and electronic equipment | |
CN112287261A (en) | Resource loading method and electronic equipment | |
CN111147790A (en) | Auxiliary function starting method, mobile terminal and computer readable storage medium | |
CN107589954B (en) | Application program updating method and device, terminal and computer readable storage medium | |
CN108572985B (en) | Page display method and device | |
CN115423680A (en) | Face makeup migration method, device and computer-readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |