uniapp画原生图片圆形按钮

//创建锁屏图片
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
    );
});

如果您觉得上面的内容对您有帮助,可以打赏支持一下!

打赏

关键词:uniapp

网友留言(0 条)

发表评论

验证码