我想创建一个带有滚动列表视图的弹出窗口,列表视图将包含图像,
我尝试用这段代码实现它:
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
AlertDialog.Builder builder = new AlertDialog.Builder(groupContext);
builder.setTitle("Group");
builder.setItems(arrayNames, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
Toast.makeText(getApplicationContext(), arrayNames[item], Toast.LENGTH_SHORT).show();
}
});
builder.setPositiveButton("OK ", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
System.out.println("OK CLICKED");
}
});
builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
}
});
此代码对我有用,但是我无法添加图像并且 listView 不滚动
多谢