java - Popup listView scroll and with imgaes -
i want create popup scroll listview , listview contain images,
i tried implement code:
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(); } });
this code working me, cant add images , listview not scroll
thanks alot
you need define custom dialog xml layout containing listview.
steps:
- define xml layout listview
- set xml layout inside dialog using below:
dialog = new dialog(myactivity.this); dialog.setcontentview(r.layout.my_listview_layout);
check simple example: android custom dialog example
Comments
Post a Comment