I am following this code to create custom dialog but i am not getting how to remove dialog title bar ?
AlertDialog alertDialog; @Override protected Dialog onCreateDialog(int id) { AlertDialog dialogDetails = null; switch (id) { case DIALOG_LOGIN: LayoutInflater inflater = LayoutInflater.from(this); View dialogview = inflater.inflate(R.layout.dialog_layout, null); AlertDialog.Builder dialogbuilder = new AlertDialog.Builder(this); dialogbuilder.setTitle("Login"); dialogbuilder.setView(dialogview); dialogDetails = dialogbuilder.create(); break; } return dialogDetails; } @Override protected void onPrepareDialog(int id, Dialog dialog) { switch (id) { case DIALOG_LOGIN: alertDialog = (AlertDialog) dialog; ....... }
I know to remove title area of the Alert Dialog, we have to use requestWindowFeature(Window.FEATURE_NO_TITLE);
But don't know where i have to place above line ?
AlertDialog generally consists of the main title, the message, and two buttons, technically termed as a positive button and a negative button. Both positive and negative buttons can be programmed to perform various actions. By default, the negative button lets close the AlertDialog without any additional lines of code.
Android AlertDialog can be used to display the dialog message with OK and Cancel buttons. It can be used to interrupt and ask the user about his/her choice to continue or discontinue. Android AlertDialog is composed of three regions: title, content area and action buttons.
AlertDialog is a lightweight version of a Dialog. This is supposed to deal with INFORMATIVE matters only, That's the reason why complex interactions with the user are limited. Dialog on the other hand is able to do even more complex things .
If you don't want title bar in alert dialog then just remove below line from code.
dialogbuilder.setTitle("Login");
If still not working then add below line.
dialogbuilder.requestWindowFeature(Window.FEATURE_NO_TITLE);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With