讨论广场 问答详情
音量条宽度怎么改
hahahah 2025-09-01 19:59:53
32 评论 分享


有人知道音量条的这个宽度72怎么改吗,app源码里面只能按百分比修改但这个宽度还是72不会变化

32 评论 分享
写回答
全部评论(2)
1 楼

改下窗口的宽度:

applications_systemui\product\default\volumepanel\src\main\ets\pages\index.ets中

if (configInfo.width > configInfo.height) { // Pad、PC Mode
  const realWidth = 48;
  const realHeight = 284;
  volumeRect = {
    left: configInfo.width - vp2px(16) - vp2px(realWidth),
    top: (configInfo.height - vp2px(realHeight) ) / 2,
    width: vp2px(realWidth) , //pad改这里
    height: vp2px(realHeight)
  };
} else { // Phone Mode
  const realWidth = 48;
  const realHeight = 284;
  volumeRect = {
    left: configInfo.width - vp2px(16) - vp2px(realWidth),
    top: configInfo.height * 0.1,
    width: vp2px(realWidth) , //phone改这里,
    height: vp2px(realHeight)
  };
}
2025-09-02 09:50:34
2 楼

width: vp2px(realWidth) , 改一下这里的宽度即可。同时改一下左右边距。

2025-09-02 09:51:45