Change the look of AlertDialog to the old one

1

I have this code that creates an 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

AndthisistheresultIwouldlikeittoleave

    
asked by anonymous 20.05.2017 / 19:23

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);

* Before the theme was used: AlertDialog.THEME_HOLO_LIGHT , according to the new documentation this theme is obsolete.

If you'd like to take a look at themes .

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

    
20.05.2017 / 19:38