0

I have created a Fragment Dialog and i want to remove the blue divider from dialog box.
Here my code:-

public class Dialogue  extends DialogFragment {
    @Override
    public android.app.Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        Bundle args = getArguments();

        builder.setTitle("Update");
        builder.setMessage("click Yes to update your Application");

        builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                //do stuff here
                try {
                    Intent intent = new Intent(Intent.ACTION_VIEW);
                    intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.shopclues"));
                    startActivity(intent);
                    dismiss();
                } catch (ActivityNotFoundException e) {
                    Intent intent = new Intent(Intent.ACTION_VIEW);
                    intent.setData(Uri.parse("https://play.google.com/store/apps/developer?id=ShopClues&hl=en"));
                    startActivity(intent);
                    dismiss();
                }
            }
        });
        //cancel button with dismiss.
        builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                Intent i = getActivity().getPackageManager().getLaunchIntentForPackage("com.shopclues");
                getActivity().startActivity(i);
                dismiss();
            }
        });

        return builder.create();
    }
}

Thanks in advance

Sachin Mhetre
  • 4,465
  • 10
  • 43
  • 68

1 Answers1

0

You can use your own custom layout for Alert dialog.

 @Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    // Get the layout inflater
    LayoutInflater inflater = getActivity().getLayoutInflater();

    // Inflate and set the layout for the dialog
    // Pass null as the parent view because its going in the dialog layout
    builder.setView(inflater.inflate(R.layout.dialog_signin, null))
    // Add action buttons
           .setPositiveButton(R.string.signin, new DialogInterface.OnClickListener() {
               @Override
               public void onClick(DialogInterface dialog, int id) {
                   // sign in the user ...
               }
           })
           .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
                   LoginDialogFragment.this.getDialog().cancel();
               }
           });      
    return builder.create();
}

Please consider to read the documentation first

Alex Chengalan
  • 8,211
  • 4
  • 42
  • 56