createUserInfoButton创建的按钮如何自适应位置和大小!
发布于 6 年前 作者 jingdeng 11686 次浏览 来自 问答

我使用的是白鹭引擎,游戏的设计尺寸是FIXWIDTH,480*854,现在需要把createUserInfoButton创建的按钮放在设计尺寸的相对于左下角的138*169位置上面。下面的代码在IOS上面是可以工作的。但是安卓下面就不行。请教一下各位大佬有遇到过的吗?白鹭使用的是webgl

// 没有授权,显示授权按钮

var canvas = window.canvas;

var stageContentSize = window.GameInterface.GetStageContentSize();

var canvasWidth = canvas.offsetWidth;

if (canvasWidth == null){

canvasWidth = canvas.width;

}

var scale = canvasWidth / stageContentSize.width;

var button = wx.createUserInfoButton({

type: ‘image’,

image: ‘innerRes/AuthButton.png’,

style: {

left: 138 * scale,

top: (stageContentSize.height - 169) * scale,

width: 196 * scale,

height: 57 * scale,

}

});

2 回复

按钮图片出现了吗

这个问题解决了吗

回到顶部