The designWidth parameter used to be set as the width of the device screen. However, this will cause a stretch of app content when displayed on a wider screen, leading to poor display effect on a Vision product, in the landscape mode, and on an unfolded screen that is foldable screen.
You can develop new apps or reconstruct existing apps using the responsive layout of quick apps. In this way, your quick app can be well displayed on devices of various resolutions, including mobile phones, tablets, and Vision products.
"minPlatformVersion": 1066,
"config": {
"designWidth": "device-width"
}, Plan the size and position of UI elements based on common screen widths:
Pay attention to the following when designing the layout:
If a dynamic layout cannot achieve the effect you need, you can use the responsive layout capability provided by MediaQuery.
The following sample code implements the effect of dynamically control the number of columns in a list based on the screen width:
/**
* For a regular phone in portrait mode (360 px wide), display three images in a line, with each image occupying 120 px.
*/
@media screen and (min-width: 0) and (max-width: 239) {
.list {
columns: 1;
}
}
@media screen and (min-width: 240) and (max-width: 359) {
.list {
columns: 2;
}
}
@media screen and (min-width: 360) and (max-width: 479) {
.list {
columns: 3;
}
}
@media screen and (min-width: 480) and (max-width: 599) {
.list {
columns: 4;
}
}
@media screen and (min-width: 600) and (max-width: 719) {
.list {
columns: 5;
}
}
@media screen and (min-width: 720) and (max-width: 839) {
.list {
columns: 6;
}
}
@media screen and (min-width: 840) and (max-width: 959) {
.list {
columns: 7;
}
}
@media screen and (min-width: 960) and (max-width: 1079) {
.list {
columns: 8;
}
}
@media screen and (min-width: 1080) {
.list {
columns: 9;
}
} The following figure shows the final effect.

"minPlatformVersion": 1066,
"config": {
"designWidth": "device-width"
}, Plan the size and position of UI elements based on common screen widths. Common screen widths are as follows:
Set designWidth to device-width and set the new resolution in the UX and CSS files in your project. Formula for the resolution conversion: New resolution = Original resolution x 36/75.
For example, if the original width and height are both 75 px, the new width and height are 36 px.

You can also download the conversion tool. Run the following command for conversion:
java -jar convert.jar -root D:\workspace\quickapp\project -formats "ux;css"
Adaptation for a card is the same as that for a quick app except the change of designWidth.
The modification method is as follows:
Open the UX file corresponding to the card and add designWidth="device-width" to the level-1 node in template.

In this example, designWidth is set to 750 at first. Before the adaptation, the display effects on a foldable screen after being folded and unfolded are shown in the following figures. It is obvious that the size of each element is enlarged when the screen is unfolded.



d:\>java -jar convert.jar -root D:\workspace\fastapp\MultiLayout -formats "ux;css"
The following figure shows the configurations before and after the conversion.

After the conversion, only two images are displayed in one line on the wide screen, leaving much empty space.

The following figure shows the display effect after the adaptation.
