koifish082
10/15/2018 - 8:48 AM

dialog example to adjust mergin

public class DialogUtils {

    public static void showOkButtonDialog(Context context, String message) {

        View view = LayoutInflater.from(context).inflate(R.layout.view_alert_dialog, null, false);
        android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(context);
        builder.setView(view);

        android.app.AlertDialog alert = builder.create();
        ColorDrawable back = new ColorDrawable(android.graphics.Color.TRANSPARENT);
        InsetDrawable inset = new InsetDrawable(back, 100);
        alert.getWindow().setBackgroundDrawable(inset);

        TextView txtText = view.findViewById(R.id.tv_dialog_content);
        txtText.setText(message);

        TextView button = view.findViewById(R.id.tv_dialog_positive);
        button.setOnClickListener(v -> alert.dismiss());

        alert.show();
    }
}