How can i add title to this custom dialog??
I have tried like this
Why not use an AlertDialog
if you have 3 or less buttons?
My AlertDialog looks like this:
My java code:
LayoutInflater inflater = (LayoutInflater)getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.add_filter, null);
AlertDialog alertDialog = new AlertDialog.Builder(this)
.create();
alertDialog.setTitle("AlertDialog title");
alertDialog.setMessage("AlertDialog message");
alertDialog.setView(view);
alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
dialog.dismiss();
}
});
alertDialog.show();
My XML:
Simple yet does what you need.