Android-AlertDialog-Listview:安卓列表对话框
AlertDialog.Builder adBuilder = new AlertDialog.Builder(MainActivity.this);
adBuilder.setTitle("列表对话框");
/** 列表内容*/
final String[] items = {"item 1", "item 2", "item 3"};
adBuilder.setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Snackbar.make(coordinatorLayout, "You clicked " + items[which], Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
/** 设置是否可以取消*/
adBuilder.setCancelable(false);
AlertDialog ad = adBuilder.create();
ad.show();