Android/TextView 16进制显示,加0x头,不足2位补0

var str =Integer.toHexString(progress)
                // orderArr[3] = progress.toByte() //错误的写法
                orderArr[3] = str.toInt(16).toByte()
                msg.text = if(str.length > 1) "0x$str" else "0x0$str"
原文地址:https://www.cnblogs.com/cnwy/p/13785091.html