uniapp画原生图片圆形按钮

  |   0 评论   |   178 浏览

//创建锁屏图片
let button1 = new plus.nativeObj.Bitmap('bmp1');
//图片加载完毕
button1.load('static/suo1.png', () => {
	//创建view
	this.suo1 = new plus.nativeObj.View('suo1', { top: this.screenWidth / 2 - 32 + 'px', left: '40px', height: '54px', width: '54px', backgroundColor: 'transparent' });
	//圆形半透明背景
	this.suo1.drawRect({ color: 'rgba(0,0,0,0.2)', radius: '27px' }, { top: '0px', left: '0px', width: '100%', height: '100%' });
	//画锁图片
	this.suo1.drawBitmap(button1, { top: '0px', left: '0px', width: '100%', height: '100%' }, { top: 'auto', left: 'auto', width: '50%', height: '50%' });
	this.suo1.hide('auto', 0);
	this.suo1.addEventListener(
		'click',
		() => {
		
		},
		false
	);
});

--------------------------------
云深不知归处
先沉稳而后爱人

评论

发表评论