上顯示除法我有這個類:打開AlertDialog不清單
public class PageDetailInfoView extends FrameLayout {
//few constructors and methods
//method to show an AlertDialog with a list
private void openDialog(){
List<String> mTags = new ArrayList<String>();
mTags.add("Item1");
mTags.add("Item2");
mTags.add("Item3");
mTags.add("Item4");
mTags.add("Item5");
mTags.add("Item6");
final CharSequence[] tags = mTags.toArray(new String[mTags.size()]);
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle("Title");
builder.setItems(tags, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
//do something
}
});
Dialog alertDialogObject = builder.create();
alertDialogObject.show();
}
警告對話框後調用openDialog(),但事情是,它並沒有表現出項目之間的分隔。 我希望得到這樣的:
http://2.bp.blogspot.com/-i00d8VG6WsQ/UrGIeyb-8II/AAAAAAAAHwA/8MPWP5qrQ78/s500/alertdialog-with-simple-listview.png
,事實上,我得到它,但沒有灰色分隔。
有關爲什麼的任何想法?
謝謝,但我不能訪問.getListView() – JoCuTo
這個工程!但你必須改變'對話alertDialogObject = dialogBuilder.create();'AlertDialog alertDialogObject = dialogBuilder.create(); ' –
是的作品!非常感謝 – JoCuTo