Kotlin 中使用 AlertListDialog
如下所示的 dialog 经常看到
实现如下所示:
val list = Array(1, { "打开应用","卸载应用","查看详情","去市场查看" })
android.support.v7.app.AlertDialog.Builder(this).setItems(list, DialogInterface.OnClickListener { _, i ->
when (i) {
0 -> {
Log.d(TAG,"open");
}
1 -> {
Log.d(TAG,"uninstall");
}
2 -> {
Log.d(TAG,"detail");
}
3 -> {
Log.d(TAG,"watch");
}
}
}).create().show()