感谢您对车机快应用生态的支持,车机快应用开发前请先联系您的商务经理,确认分发的车型后再启动开发。


已在manifest.json中配置过的路径,不可作为新建卡片的路径。
例如:manifest.json中path配置了/c1,则不能在src/c1路径新建卡片。需更改文件夹或者新建文件夹,如src/c2。

已在manifest.json中配置过的路径,不可作为新建卡片的路径。
例如:manifest.json中path配置了/c1,则不能在src/c1路径新建卡片。需更改文件夹或者新建文件夹,如src/c2。

新建卡片成功后,可在manifest.json文件中看到卡片的相关配置。
"minPlatformVersion": 1045,
"config": {
"designWidth": "device-width"
},以某11寸车机为例,分辨率1152*1184,屏幕密度为1.125,则真实宽度为 1152/1.125=1024。
当原designWidth为1152时,原来 font-size:60 px 转换后变成 font-size:53.3 px。
当原designWidth为750时,原来 font-size:60 px 转换后变成 font-size:81.9 px。
也可以下载 convert工具 对项目文件进行批量转换,运行命令如下:
java -jar convert.jar -root “d:\quickapp\proj” -formats "ux;css" -oldDesignWidth 750 -destScreenDps 360
750替换为原始配置的宽度,360替换为屏幕的真实宽度。
由于不同厂商车机横屏竖屏宽度差别较大,配置device-width且尺寸转换之后,可能仍然无法兼顾多种屏幕显示效果,此时可以使用MediaQuery进行动态布局,详细请参见“MediaQuery响应式布局能力”。 例如需要区分1024宽度和1280宽度屏幕,可用以下代码实现:
@media screen and (min-width: 0) and (max-width: 1079) {
.list {
columns: 2;
}
.subtitle {
font-size: 30px;
width: 60px;
}
/*此处可以根据需要修改组件样式*/
}
@media screen and (min-width: 1080) and (max-width: 2159) {
.list {
columns: 4;
}
.subtitle {
font-size: 20px;
width: 40px;
}
/*此处可以根据需要修改组件样式*/}
} 响应式布局实现的重要一步在于分割点的划分,即不同宽度范围,我们建议根据常见屏幕宽度按照以下区间划分屏幕范围。
开发者也可以在此基础上根据实际需求修改或者增加新的划分条件,以达到目标效果。
| 序号 | 宽(dp) | 高(dp) | DP区间(宽度) |
|---|---|---|---|
| 1 | 860 | 645 | 800-960 |
| 2 | 878 | 1024 | 800-960 |
| 3 | 912 | 540 | 800-960 |
| 4 | 960 | 500 | 800-960 |
| 5 | 994 | 559 | 960-1120 |
| 6 | 1024 | 1053 | 960-1120 |
| 7 | 1078 | 405 | 960-1120 |
| 8 | 1280 | 480 | 1120-1280 |
| 9 | 1280 | 720 | 1120-1280 |
| 10 | 1345 | 624 | 1280以上 |
@media screen and (max-width: 959) {
.list {
columns: 3;
flex-direction: column;
}
.subtitle{
font-size: 36px;
width: 512px;
height:50px;
background-color:#0000ff;
text-align: center;
color: #00ff00;
}
}
@media screen and (min-width: 960) and (max-height:1119) {
.list {
columns: 4;
flex-direction: column;
}
.subtitle{
font-size: 48px;
width: 512px;
height:50px;
background-color:#add8e6;
text-align: center;
color: #ffff00;
}
}
@media screen and (min-width: 1120) and (max-height:1279) {
.list {
columns: 5;
flex-direction: column;
}
.subtitle{
font-size: 60px;
width: 512px;
height:50px;
background-color:#fafad2;
text-align: center;
color: #ff0000;
}
}
@media screen and (min-height: 1279) {
.list {
columns: 6;
flex-direction: column;
}
.subtitle{
font-size: 72px;
width: 512px;
height:50px;
background-color:#daa520;
text-align: center;
color: #00ff00;
}
} 在宽度1024dp的屏幕显示效果:

在宽度1280dp的屏幕显示效果:
