+-
                                
                                    
                                
                                
                                    
                                
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                            
                                        
                                        
                                    
                                
                            
                        
  我编写了一个显示弹出对话框的 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
    }
 
  最佳答案 
 
  如果您只想要一个浅色主题而不是特定颜色,那么您可以将主题ID传递给AlertDialog.Builder构造函数. 
  
  
 
    
AlertDialog.Builder(this, AlertDialog.THEME_HOLO_LIGHT)...
 
 要么
AlertDialog.Builder(this, AlertDialog.THEME_DEVICE_DEFAULT_LIGHT)...
 
  点击查看更多相关文章 
 
转载注明原文:android – 更改弹出对话框的背景颜色 - 乐贴网