a、java环境下的Dialog转换为Kotlin环境下的Dialog
var dialog = AlertDialog.Builder(this)
dialog.setTitle("还珠楼主")
.setMessage("飘渺峰还珠楼")
.setPositiveButton("神蛊温皇"){ dialogInterface: DialogInterface, i: Int ->
logging("剑、蛊、毒三合一")
}
.setNegativeButton("秋水浮萍任缥缈"){ dialogInterface: DialogInterface, i: Int ->
logging("我想陪伴你每一轮的365个日日夜夜")
}
.setCancelable(false)
.create()
.show()
b、Kotlin环境下利用Anko库创建Dialog:
alert("飘渺峰还珠楼", "还珠楼主"){
positiveButton("神蛊温皇"){
logging("哈哈哈哈哈,你想说什么?")
}
negativeButton("秋水浮萍任缥缈"){
logging("我也想陪伴你每一轮的365个日日夜夜")
}
}.show()