Change the appearance of Alertdialog to the old one

Asked

Viewed 57 times

1

I have this code that creates a Alertdialog

public void mostrar_popup(){
    AlertDialog.Builder dlg = new AlertDialog.Builder(getActivity());
    dlg.setCancelable(false); //impede que a janela seja fechada ao clikcar fora
    dlg.setMessage("É preciso digitar um texto para continuar ");
    dlg.setNeutralButton("OK",null);
    dlg.setPositiveButton("sim",null);
    dlg.create();
    dlg.show();
}

And the result is this

inserir a descrição da imagem aqui

And that’s the result I’d like you to leave

inserir a descrição da imagem aqui

1 answer

1


You can set the theme by parameter in AlertDialog.Builder(Context context, int themeResId), as follows:

AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this, android.R.style.Theme_DeviceDefault_Light_Dialog_Alert);

*Used to be the theme: AlertDialog.THEME_HOLO_LIGHT, according to the new documentation this theme is obsolete.

In case you want to take a look at themes available.

You can also create your own custom theme, as per this reply.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.