亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

QR code 生成的二維碼

QR code 生成的二維碼

大咪 2016-09-23 10:11:59
這個生成的二維碼怎么做才能讓它實現掃碼跳轉到網頁呀,老師講的都是直接顯示出字符串來。。。 Qrcode?x?=?new?Qrcode(); x.setQrcodeErrorCorrect('M');//?糾錯等級 x.setQrcodeEncodeMode('B');//?N代表數字,A代表a-,B代表其他字符 x.setQrcodeVersion(7);//?版本 String?qrData?=?"www.xianlaiwan.cn"; int?width?=?67?+?12?*?(?7?-?1?); int?height?=?67?+?12?*?(?7?-?1?); BufferedImage?bufferedImage?=?new?BufferedImage(width,?height,?BufferedImage.TYPE_INT_RGB); Graphics2D?gs?=?bufferedImage.createGraphics(); gs.setBackground(Color.white); gs.setColor(Color.black); gs.clearRect(0,?0,?width,?height); int?pixoff?=?2;//?偏移量 byte[]?d?=?qrData.getBytes("gb2312"); if?(d.length?>?0?&&?d.length?<?120)?{ boolean[][]?s?=?x.calQrcode(d); for?(int?i?=?0;?i?<?s.length;?i++)?{ for?(int?j?=?0;?j?<?s.length;?j++)?{ if?(s[j][i])?{ gs.fillRect(j?*?3?+?pixoff,?i?*?3?+?pixoff,?3,?3); } } } } //如果要是修改的話是不是得需要把上邊的String改成Url去處理呢?求解答 gs.dispose(); bufferedImage.flush(); ImageIO.write(bufferedImage,?"png",?new?File("D:/code/qrcode.png")); }
查看完整描述

1 回答

已采納
?
iHelin

TA貢獻5條經驗 獲得超1個贊


String?qrData?=?"http://www.xianlaiwan.cn";,其實這個也是app自己實現的識別跳轉,本質上其實還是一段文本

查看完整回答
反對 回復 2016-09-25
  • 1 回答
  • 0 關注
  • 1726 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號