Android开发笔记:
final String[] items3 = new String[]{"条目1", "条目2", "条目3", "条目4","条目5", "条目6", "条目7", "条目8"};//创建item
AlertDialog alertDialog3 = new AlertDialog.Builder(this)
.setTitle("选项标题")
.setIcon(R.mipmap.ic_launcher)
.setItems(items3, new DialogInterface.OnClickListener() { //添加列表
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Toast.makeText(MainActivity.this, "点的是:" + items3[i], Toast.LENGTH_SHORT).show();
}
})
.create();
alertDialog3.show();