I want to make a custom alert dialog such as this image what i will do to make that ? i want to design this dialogAlert Dialog
2
-
1what have you done so far ? Where is your code ?Ahlem Jarrar– Ahlem Jarrar2017-10-19 10:03:55 +00:00Commented Oct 19, 2017 at 10:03
-
i want to design this dialog and i have no idea how to design itYousry Badr– Yousry Badr2017-10-19 10:13:57 +00:00Commented Oct 19, 2017 at 10:13
Add a comment
|
1 Answer
First of all you need to create a new layout xml file and a new layout for your title if you want custom title also.
final AlertDialog dialog;
final View alertDialogView = LayoutInflater.from(getContext()).inflate
(R.layout.your_layout, null);
final View titleView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_layout, null);
dialog = new AlertDialog.Builder(getContext())
.setView(alertDialogView)
.setCustomTitle(titleView)
.setPositiveButton(R.string.set, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
///do your job
})
.setCancelable(true)
.create();
dialog.show();
also if you want to access the title from custom layout you can access it in this way:
((TextView) titleView.findViewById(R.id.title)).setText(getString(R.string.
your_string));
1 Comment
Yousry Badr
i don't have any problems in implementation