相关疑难解决方法(0)

更改弹出对话框的背景颜色

我编写了一个显示弹出对话框的android代码,但是我想将背景颜色从黑色更改为白色,然后是写入的颜色.

这是对话框的代码:

mPrefs = PreferenceManager.getDefaultSharedPreferences(this);

    Boolean welcomeScreenShown = mPrefs.getBoolean(welcomeScreenShownPref, false);

    if (!welcomeScreenShown) {


        String whatsNewText = getResources().getString(R.string.Text);
        new AlertDialog.Builder(this).setMessage(whatsNewText).setPositiveButton(
                R.string.ok, new DialogInterface.OnClickListener(){
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        }).show();
        SharedPreferences.Editor editor = mPrefs.edit();
        editor.putBoolean(welcomeScreenShownPref, true);
        editor.commit(); // Very important to save the preference
    }
Run Code Online (Sandbox Code Playgroud)

android background-color android-alertdialog

40
推荐指数
6
解决办法
9万
查看次数