警报对话框按钮太近

sin*_*nek 6 user-interface android themes material-design

我看到这个东西与警报对话框的按钮接触(它们之间没有空格)。

在此处输入图片说明

无论使用何种主题,都会发生这种情况。代码:

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();
Run Code Online (Sandbox Code Playgroud)

应用主题继承:

 <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
Run Code Online (Sandbox Code Playgroud)

我试图用 Alert.Dialog 建立一个最小的项目设置,我看到了同样的事情..

任何想法发生了什么或如何解决它?

编辑:我知道我可以更改警报的主题以产生不同的结果,但这也意味着我的应用程序中不会有统一的按钮(即绿色填充白色文本)

Pra*_*ani 16

只需从支持的库中更改AlertDialog 的导入类:

import androidx.appcompat.app.AlertDialog;
Run Code Online (Sandbox Code Playgroud)

代替

import android.app.AlertDialog;
Run Code Online (Sandbox Code Playgroud)

谢谢你。