小编Ant*_*tti的帖子

更改对话框按钮颜色

有什么方法可以更改默认对话框按钮的颜色,或者我需要为此做自定义对话框吗?

这是我的对话:

private void removeItem(final int position) {
    /** Create dialog which ask if user is sure about delete name from list **/
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Delete player");
    builder.setIcon(R.mipmap.ic_launcher);
    builder.setMessage("Do you want to delete player: \"" + mNameList.get(position).getText1() + "\"?")
            .setCancelable(false)

            /** If user click "ok" button, delete player from list and save changes **/
            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    mNameList.remove(position);
                    mAdapter.notifyItemRemoved(position);
                    saveData();
                }
            })

            /** If user click "cancel" button, …
Run Code Online (Sandbox Code Playgroud)

android android-alertdialog material-design material-components material-components-android

4
推荐指数
2
解决办法
3711
查看次数