CFAlertDialog icon indicating copy to clipboard operation
CFAlertDialog copied to clipboard

How to arrange the buttons in a row?

Open EfremovAV opened this issue 6 years ago • 1 comments

I can't place several buttons in one row. How can I do that?

EfremovAV avatar Apr 12 '19 14:04 EfremovAV

You can create a custom layout and attach it to the dialog by using setFooterView

Hope it helps

LayoutInflater inflater = this.getLayoutInflater();
final View footer = inflater.inflate(R.layout.dialog_alert_footer_layout, null);
footer.findViewById(R.id.yesButton).setOnClickListener(v -> { 
    // 
});
footer.findViewById(R.id.noButton).setOnClickListener(v -> {
    // 
});

CFAlertDialog.Builder builder = new CFAlertDialog.Builder(this)
        .setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT)
        .setTitle(title)
        .setMessage(message)
        .setCancelable(false)
        .setTextGravity(Gravity.CENTER_HORIZONTAL)
        .setHeaderView(header)
        .setFooterView(footer)

keskin avatar Nov 29 '20 11:11 keskin