Layoutinflater Inflater = This. Getlayoutinflater (); View View= Inflater.inflate (R.layout.test_alertdialog_listview,NULL); ListView LV=(ListView) View.findviewbyid (R.id.test_alertdialog_listview); Lv.setadapter (NewArrayadapter ( This, Android. R.layout.simple_list_item_1,datas)); Lv.setonitemclicklistener (NewOnitemclicklistener () {@Override Public voidOnitemclick (adapterview<?>Parent, view view,intPositionLongID) {Alertdialog.dismiss (); Toast.maketext (testandroid. This, Datas[position], Toast.length_long). Show ();}); Alertdialog=NewAlertdialog.builder ( This)//. Setview (view);. Setitems (Datas,NewDialoginterface.onclicklistener () {@Override Public voidOnClick (Dialoginterface Dialog,intwhich) {//TODO auto-generated Method Stub}}). Create ();//You can use the Setview method here to set the distance between the layout file and the surrounding border of the alertdialog, eliminating the black borderAlertdialog.setview (view, 0, 0, 0, 0); Alertdialog.show ();
Android alertdialog remove black edge white edge custom layout (GO)