android how to customize a dialog to looks like below image
I unable to get , Is this a activity or a customized dialog(If it is a dialog then which dialog it is? Dialog, or AlertDialog, or AlertDialog.Builder) Plz anybody give some idea what is 开发者_开发百科used here.
Thank you
This looks like a custom dialog to me as you can see the background activity behind. You can create this custom Dialog
by making custom layout and call setContentView()
for the layout. Making the custom layout for dialog is similar to layout for activities.
For that particular case you gave, I might create a layout with a centered TextView
on top following by a divider, then continues with other ImageView
and TextView
. It might not look the same but somehow
It is custom dialog box you only need to make custom_dialog.xml in layout folder. And call it from your activity. for example: Builder builder = new Builder(DialogActivity.this); LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View dialogView = inflater.inflate(R.layout.custom_dialog, null); builder.setView(dialogView); builder.setPositiveButton("Save", new DialogInterface.OnClickListener() { ---------------- } builder.setNegativeButton("Cancel",null);
AlertDialog dialog = builder.create();
dialog.show();
}
精彩评论