I see this thing with Alert dialog's buttons touching (there is no space between them).
This happens regardless of the theme being used.. Code:
builder.setTitle(R.string.sign_in_title);
builder.setCancelable(false)
.setPositiveButton(R.string.sign_in, (dialog, id) -> {
//Todo
})
.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.cancel());
builder.create().show();
App theme inherits:
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
I tried to build a minimum project setup just with Alert.Dialog and I see the same thing..
Any ideas what is going on or how to fix it?
Edit: I'm aware that I can change Alert's theme to yield different results but that also implies that I won't have uniform buttons across my app (i.e. green filled with white text)
Set the onClickListener during the creation of the dialog to null. Then set a onClickListener after the dialog is shown.
AlertDialog. A dialog that can show a title, up to three buttons, a list of selectable items, or a custom layout.
You can do this very easily. AlertDialog. Builder alertDialogBuilder = new AlertDialog. Builder(context); // set title alertDialogBuilder.
Just change imported class for AlertDialog from Supported Library:
import androidx.appcompat.app.AlertDialog;
instead of
import android.app.AlertDialog;
Thank you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With